# libraries
xfun::pkg_attach2(c("tidyverse", # load all tidyverse packages
"here", # set file path
"MatchIt", # for matching
"optmatch", # for matching
"cobalt")) # for matching assessment
# chunk options ----------------------------------------------------------------
knitr::opts_chunk$set(
warning = FALSE # prevents warning from appearing after code chunk
)
# prevent scientific notation
# ----------
options(scipen = 999)
df <- read_csv("/Users/quinn/Documents/GradSchool/Spring2024/CSS/Computational-Social-Science-Training-Program/Projects/Project 6/data/ypsps.csv")
## Rows: 1254 Columns: 174
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## dbl (174): interviewid, college, student_vote, student_meeting, student_othe...
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
control.
df <- df %>%
mutate(RandTreatment = rbinom(n = nrow(df), size = 1, prob = 0.5),# Randomized 50% treatment effect
)
head(df[c("college", "RandTreatment")], 15)
## # A tibble: 15 × 2
## college RandTreatment
## <dbl> <int>
## 1 1 0
## 2 1 1
## 3 1 1
## 4 0 1
## 5 1 1
## 6 1 0
## 7 1 0
## 8 1 0
## 9 0 1
## 10 0 1
## 11 1 1
## 12 0 0
## 13 1 0
## 14 1 1
## 15 0 1
Choose a baseline (binary) covariate for either the student or parent. Visualize the distribution of the covariate by treatment/control condition.
# get treatment status by whether student demonstrated
df %>%
mutate(demonstrated = case_when(student_demonstrate == 0 ~ "No",
student_demonstrate == 1 ~ "Yes"),
treatment = case_when(RandTreatment == 0 ~ "Control",
RandTreatment == 1 ~ "Treatment")
) %>% # pipe into plot funcitons
ggplot(aes(x = student_demonstrate, fill = treatment)) +
# create a bar plot using geom_bar()
geom_bar() +
geom_text(stat = "count", aes(label = ..count..), vjust = -1 # calculate count
) +
# facet grid over facet_wrap
facet_grid(
cols = vars(treatment) # facets variable in the column
) +
# theme
theme_bw() + # set base black and white theme
theme(legend.position = "bottom") + # theme functions manipulate different elements of the plots appearance
# scales
# scale_fill_manual(values=c("#800000","#027148")) + # assign colors using hex code
scale_y_continuous(breaks=seq(0, 1000, 100), # y axis floor, ceiling, step
labels = scales::label_number(scale = 1, # scale the variable
accuracy = 1, # decimal points
big.mark = ",", # add "," or "."
prefix = "", # add "$"
suffix = ""), # add suffix, e.g., "%" or "k"
limits = c(0, 1000)) + # set floor and ceiling
# labels
labs(x = "Student Participation in Demonstration", # x-axis label
y = "Count", # y-axis label
fill = "Treatment status", # legend label
caption = "Note: ", # add a caption
title = "Distribution of Demonstrative Student Treatment Status") # title
Are treatment and control balanced on this covariate?
They appear to be given the visual distribution. We can perform a X^2 test to confirm
# Run chai squared test
chisq.test(table(df$RandTreatment, df$student_demonstrate))
##
## Pearson's Chi-squared test with Yates' continuity correction
##
## data: table(df$RandTreatment, df$student_demonstrate)
## X-squared = 2.1262, df = 1, p-value = 0.1448
Given the large p-value, we do not see evidence that the treatment and control groups are unbalanced
treatment/control balance across the simulations.
##install.packages("reshape2")
set.seed(123) # reproducibility
differences <- replicate(10000, {
# Randomly assign treatment
df$RandTreatment <- rbinom(n = nrow(df), size = 1, prob = 0.5)
# create table to easily calculate differences with
diff_table <- table(df$RandTreatment, df$student_demonstrate)
# find difference in treatment vs control of demonstration
dnd_diff <- diff_table["1", "0"] - diff_table["0", "0"]
d_diff <- diff_table["1", "1"] - diff_table["0", "1"]
# return vector of two differences
c(dnd_diff, d_diff)
}, simplify = "array")
differences_T = t(differences)
# Convert to data frame for plotting
diff_df <- data.frame("DND" = differences_T[,1], "Demonstrated" = differences_T[,2])
# Melt the data frame for easier plotting
library(reshape2)
##
## Attaching package: 'reshape2'
## The following object is masked from 'package:tidyr':
##
## smiths
diff_df_melted <- melt(diff_df)
## No id variables; using all as measure variables
# Plot
ggplot(diff_df_melted, aes(x = value)) +
geom_histogram(binwidth = 1, fill = "blue", color = "grey", alpha = 0.8) +
facet_wrap(~ variable, ncol = 1, scales = "free_y", labeller = labeller(variable = c(`DND` = "Did Not Demonstrate", `Demonstrated` = "Demonstrated"))) +
theme_minimal() +
labs(title = "Distribution of Differences in Counts",
x = "Difference in Counts",
y = "Frequency")
The simulations produced expected distributions – the difference in treatment assignment and covariates centers on 0 and follows a binomial distribution. While this may give us confidence that randomization is likely to produce evenly balanced treatment and control on our covariate, it does not guarantee it. Despite independence of treatment assignment and covariate, there is still a possibility we will not have matched or balanced data.
Select covariates that you think best represent the “true” model predicting whether a student chooses to attend college, and estimate a propensity score model to calculate the Average Treatment Effect on the Treated (ATT). Plot the balance of the covariates. Report the balance of the p-scores across both the treatment and control groups, and using a threshold of standardized mean difference of p-score ≤ .1, report the number of covariates that meet that balance threshold.
colnames(df)
## [1] "interviewid" "college"
## [3] "student_vote" "student_meeting"
## [5] "student_other" "student_button"
## [7] "student_money" "student_communicate"
## [9] "student_demonstrate" "student_community"
## [11] "student_ppnscal" "student_PubAff"
## [13] "student_Newspaper" "student_Radio"
## [15] "student_TV" "student_Magazine"
## [17] "student_FamTalk" "student_FrTalk"
## [19] "student_AdultTalk" "student_PID"
## [21] "student_SPID" "student_GovtOpinion"
## [23] "student_GovtCrook" "student_GovtWaste"
## [25] "student_TrGovt" "student_GovtSmart"
## [27] "student_Govt4All" "student_Cynic"
## [29] "student_LifeWish" "student_GLuck"
## [31] "student_FPlans" "student_EgoA"
## [33] "student_WinArg" "student_StrOpinion"
## [35] "student_MChange" "student_EgoB"
## [37] "student_TrOthers" "student_OthHelp"
## [39] "student_OthFair" "student_Trust"
## [41] "student_Senate" "student_Tito"
## [43] "student_Court" "student_Govern"
## [45] "student_CCamp" "student_FDR"
## [47] "student_Knowledge" "student_NextSch"
## [49] "student_GPA" "student_SchOfficer"
## [51] "student_SchPublish" "student_Hobby"
## [53] "student_SchClub" "student_OccClub"
## [55] "student_NeighClub" "student_RelClub"
## [57] "student_YouthOrg" "student_MiscClub"
## [59] "student_ClubLev" "student_Phone"
## [61] "student_Gen" "student_Race"
## [63] "parent_Newspaper" "parent_Radio"
## [65] "parent_TV" "parent_Magazine"
## [67] "parent_LifeWish" "parent_GLuck"
## [69] "parent_FPlans" "parent_WinArg"
## [71] "parent_StrOpinion" "parent_MChange"
## [73] "parent_TrOthers" "parent_OthHelp"
## [75] "parent_OthFair" "parent_PID"
## [77] "parent_SPID" "parent_Vote"
## [79] "parent_Persuade" "parent_Rally"
## [81] "parent_OthAct" "parent_PolClub"
## [83] "parent_Button" "parent_Money"
## [85] "parent_Participate1" "parent_Participate2"
## [87] "parent_ActFrq" "parent_GovtOpinion"
## [89] "parent_GovtCrook" "parent_GovtWaste"
## [91] "parent_TrGovt" "parent_GovtSmart"
## [93] "parent_Govt4All" "parent_Employ"
## [95] "parent_EducHH" "parent_EducW"
## [97] "parent_ChurchOrg" "parent_FratOrg"
## [99] "parent_ProOrg" "parent_CivicOrg"
## [101] "parent_CLOrg" "parent_NeighClub"
## [103] "parent_SportClub" "parent_InfClub"
## [105] "parent_FarmGr" "parent_WomenClub"
## [107] "parent_MiscClub" "parent_ClubLev"
## [109] "parent_FInc" "parent_HHInc"
## [111] "parent_OwnHome" "parent_Senate"
## [113] "parent_Tito" "parent_Court"
## [115] "parent_Govern" "parent_CCamp"
## [117] "parent_FDR" "parent_Knowledge"
## [119] "parent_Gen" "parent_Race"
## [121] "parent_GPHighSchoolPlacebo" "parent_HHCollegePlacebo"
## [123] "student_1973Married" "student_1973Military"
## [125] "student_1973Drafted" "student_1973Unemployed"
## [127] "student_1973NoEmployers" "student_1973OwnHome"
## [129] "student_1973NoResidences" "student_1973VoteNixon"
## [131] "student_1973VoteMcgovern" "student_1973CollegeDegree"
## [133] "student_1973CurrentCollege" "student_1973CollegeYears"
## [135] "student_1973HelpMinority" "student_1973Busing"
## [137] "student_1973GovChange" "student_1973VietnamRight"
## [139] "student_1973VietnamApprove" "student_1973Trust"
## [141] "student_1973Luck" "student_1973SureAboutLife"
## [143] "student_1973CurrentSituation" "student_1973FutureSituation"
## [145] "student_1973ThermMilitary" "student_1973ThermRadical"
## [147] "student_1973ThermDems" "student_1973ThermRep"
## [149] "student_1973ThermBlack" "student_1973ThermWhite"
## [151] "student_1973ThermNixon" "student_1973ThermMcgovern"
## [153] "student_1973Newspaper" "student_1973PubAffairs"
## [155] "student_1973GovtEfficacy" "student_1973GovtNoSay"
## [157] "student_1973PartyID" "student_1973IncSelf"
## [159] "student_1973HHInc" "student_1973ChurchAttend"
## [161] "student_1973Knowledge" "student_1973Ideology"
## [163] "student_1982vote76" "student_1982vote80"
## [165] "student_1982meeting" "student_1982other"
## [167] "student_1982button" "student_1982money"
## [169] "student_1982communicate" "student_1982demonstrate"
## [171] "student_1982community" "student_1982IncSelf"
## [173] "student_1982HHInc" "student_1982College"
## [175] "RandTreatment"
# We can simplify the logistic regression and matching process using matchit
# Our formula will regress "college" (treatment) on our covariates
# --------------------------------------------------
match_exact_att <- matchit(formula = college ~ student_GPA + parent_Employ, # formula
data = df, # specify dataset
method = "exact", # matching method
estimand = "ATT") # estimand
# summary
summary(match_exact_att, un = FALSE) #
##
## Call:
## matchit(formula = college ~ student_GPA + parent_Employ, data = df,
## method = "exact", estimand = "ATT")
##
## Summary of Balance for Matched Data:
## Means Treated Means Control Std. Mean Diff. Var. Ratio eCDF Mean
## student_GPA 2.2740 2.2740 -0 0.9983 0
## parent_Employ 0.6961 0.6961 -0 . 0
## eCDF Max Std. Pair Dist.
## student_GPA 0 0
## parent_Employ 0 0
##
## Sample Sizes:
## Control Treated
## All 451. 803
## Matched (ESS) 339.43 803
## Matched 448. 803
## Unmatched 3. 0
## Discarded 0. 0
# We can estimate ATT using linear regression from our exact match ATT
# construct a matched dataset with matchit
match_exact_att_data <- match.data(match_exact_att)
# specify a linear model
lm_exact_att <- lm(student_ppnscal ~ college + student_GPA + parent_Employ, # specify linear regression
data = match_exact_att_data, # data
weights = weights) # weights
# view summary of results
lm_exact_att_summ <- summary(lm_exact_att)
lm_exact_att_summ
##
## Call:
## lm(formula = student_ppnscal ~ college + student_GPA + parent_Employ,
## data = match_exact_att_data, weights = weights)
##
## Weighted Residuals:
## Min 1Q Median 3Q Max
## -3.0954 -1.2542 -0.3856 1.1112 8.8327
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.93584 0.21339 9.072 < 0.0000000000000002 ***
## college 1.23817 0.10599 11.682 < 0.0000000000000002 ***
## student_GPA -0.20661 0.07774 -2.658 0.00797 **
## parent_Employ 0.12800 0.11059 1.157 0.24732
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 1.797 on 1247 degrees of freedom
## Multiple R-squared: 0.1043, Adjusted R-squared: 0.1021
## F-statistic: 48.38 on 3 and 1247 DF, p-value: < 0.00000000000000022
#
# grab ATT
# ---------
ATT_exact <- lm_exact_att_summ$coefficients["college", "Estimate"]
ATT_exact
## [1] 1.238169
Plot the balance of the covariates. Report the balance of the p-scores across both the treatment and control groups, and using a threshold of standardized mean difference of p-score ≤ .1, report the number of covariates that meet that balance threshold.
I use the cobalt package per suggestion given its design for this purpose
library("cobalt")
match_exact_att
## A matchit object
## - method: Exact matching
## - number of obs.: 1254 (original), 1251 (matched)
## - target estimand: ATT
## - covariates: student_GPA, parent_Employ
# love plot to show standardized mean differences
love.plot(match_exact_att, # dataset
abs = TRUE, # absolute standardized mean differences
thresholds = 0.1) # define threshold parameter per prompt
Sum the number of covariates
# Generate a balance table to see SMD scores
balance_table <- bal.tab(match_exact_att, abs = TRUE)
balance_table$Balance
## Type Diff.Un Diff.Adj
## student_GPA Contin. NA 0.0000000000000142108547
## parent_Employ Binary NA 0.0000000000000003330669
**Here we can see that both covariates selected fall well below the SMD threshold of 0.1
I inadvertently read the prompt as “Select two covariates that you think best represent the true model.” Below, I rerun the above process but for all pre-treatment covariates.
df_pretreat <- df %>%
select(-((ncol(df)-2):ncol(df))) %>% # drop rand treat variables made earlier
select(-matches("1973|1982")) %>% # drop post-treatment vars
select_if(~ !any(is.na(.))) # drop columns with NA values for matchit below
head(df_pretreat)
## # A tibble: 6 × 120
## interviewid college student_vote student_meeting student_other student_button
## <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 1 1 1 0 0 0
## 2 2 1 1 1 1 1
## 3 3 1 1 0 0 1
## 4 4 0 0 0 0 0
## 5 5 1 1 1 0 0
## 6 6 1 1 0 0 0
## # ℹ 114 more variables: student_money <dbl>, student_communicate <dbl>,
## # student_demonstrate <dbl>, student_community <dbl>, student_ppnscal <dbl>,
## # student_PubAff <dbl>, student_Newspaper <dbl>, student_Radio <dbl>,
## # student_TV <dbl>, student_Magazine <dbl>, student_FamTalk <dbl>,
## # student_FrTalk <dbl>, student_AdultTalk <dbl>, student_PID <dbl>,
## # student_SPID <dbl>, student_GovtOpinion <dbl>, student_GovtCrook <dbl>,
## # student_GovtWaste <dbl>, student_TrGovt <dbl>, student_GovtSmart <dbl>, …
# grep(df_pretreat[c("student_1973Married", "student_1982money")]) # select two post treatment vars as a test
The commented line produces an error as expected. Continuing on to reproduce earlier steps with pre-treatment covariates.
match_ps_att_all <- matchit(formula = college ~ ., # all covariates
data = df_pretreat, # pretreatment df
method = "nearest",
estimand = "ATT",
distance = "glm",
link = "logit",
discard = "control",
replace = FALSE,
ratio = 2)
# summary
summary(match_ps_att_all, un = FALSE)
##
## Call:
## matchit(formula = college ~ ., data = df_pretreat, method = "nearest",
## distance = "glm", link = "logit", estimand = "ATT", discard = "control",
## replace = FALSE, ratio = 2)
##
## Summary of Balance for Matched Data:
## Means Treated Means Control Std. Mean Diff. Var. Ratio
## distance 0.9688 0.3712 2.7795 0.0098
## interviewid 892.5473 781.1765 0.2290 1.0153
## student_vote 0.8875 0.6164 0.6869 .
## student_meeting 0.4629 0.1023 0.7878 .
## student_other 0.2506 0.0665 0.4840 .
## student_button 0.4194 0.2327 0.3952 .
## student_money 0.3069 0.1049 0.4884 .
## student_communicate 0.5371 0.1765 0.7343 .
## student_demonstrate 0.3453 0.0537 0.7092 .
## student_community 0.4092 0.1944 0.4552 .
## student_ppnscal 3.6189 1.5473 1.0585 1.9956
## student_PubAff 0.9361 0.9591 -0.1022 .
## student_Newspaper 1.8235 2.1662 -0.2609 0.8179
## student_Radio 2.6343 2.8031 -0.0954 1.0056
## student_TV 2.2890 2.1790 0.0861 0.9587
## student_Magazine 1.4322 1.9514 -0.5951 0.6645
## student_FamTalk 1.7519 2.0895 -0.3666 0.7250
## student_FrTalk 1.8107 2.3478 -0.5673 0.5473
## student_AdultTalk 2.9233 2.9923 -0.0664 0.8790
## student_PID 3.9003 3.2762 0.3195 1.0672
## student_SPID 1.7110 1.7621 -0.0530 0.9093
## student_GovtOpinion 1.5857 1.7187 -0.2088 0.8488
## student_GovtCrook 2.0563 2.1202 -0.0952 1.0081
## student_GovtWaste 1.9003 1.9616 -0.0928 1.0278
## student_TrGovt 1.5857 1.7033 -0.1917 0.8782
## student_GovtSmart 1.2660 1.3120 -0.0704 0.8732
## student_Govt4All 2.6471 2.7494 -0.1513 1.2593
## student_Cynic 2.7340 2.8210 -0.0704 0.9795
## student_LifeWish 2.0665 2.2992 -0.2348 1.0968
## student_GLuck 1.1688 1.3913 -0.3959 0.4055
## student_FPlans 1.4373 1.7877 -0.3940 0.7083
## student_EgoA 3.2737 2.8542 0.4668 0.6392
## student_WinArg 2.0051 2.3708 -0.4053 1.1064
## student_StrOpinion 1.7136 1.8926 -0.1851 0.9273
## student_MChange 1.5141 1.4015 0.1406 1.1768
## student_EgoB 2.7596 2.5345 0.2277 1.2699
## student_TrOthers 1.5908 1.8005 -0.2260 0.8606
## student_OthHelp 1.7698 1.7545 0.0163 0.9692
## student_OthFair 1.3964 1.5320 -0.1666 0.8179
## student_Trust 3.1586 2.9795 0.1756 0.8707
## student_Senate 0.7238 0.3683 0.7246 .
## student_Tito 0.4834 0.1355 0.7247 .
## student_Court 0.6240 0.2839 0.6808 .
## student_Govern 0.9744 0.8312 0.5927 .
## student_CCamp 0.9744 0.7673 0.8003 .
## student_FDR 0.8670 0.5371 0.7591 .
## student_Knowledge 0.7745 0.4872 1.2617 0.6704
## student_NextSch 0.9923 0.7238 1.3336 .
## student_GPA 2.1253 2.5729 -0.6837 0.9498
## student_SchOfficer 1.9361 2.2225 -0.3457 0.8552
## student_SchPublish 1.7903 1.6419 0.1292 1.1977
## student_Hobby 1.3785 1.3836 -0.0058 0.9444
## student_SchClub 1.9668 1.4501 0.4863 1.5399
## student_OccClub 1.6215 1.9233 -0.2717 0.7821
## student_NeighClub 1.8517 1.6471 0.1798 1.2611
## student_RelClub 2.5499 2.4629 0.0764 1.0191
## student_YouthOrg 1.7749 1.5141 0.2376 1.3895
## student_MiscClub 0.3939 0.1995 0.4130 .
## student_ClubLev 1.9437 1.5192 0.3373 1.4483
## student_Phone 0.9872 0.8977 0.4646 .
## student_Gen 0.5934 0.4476 0.2929 .
## student_Race 1.0716 1.0921 -0.0671 0.9224
## parent_Newspaper 3.5831 2.8772 0.5675 0.3579
## parent_Radio 2.4987 2.3708 0.0711 0.9369
## parent_TV 3.1381 3.2506 -0.0923 0.9793
## parent_Magazine 0.7340 0.5038 0.4859 .
## parent_LifeWish 2.1100 2.1739 -0.0651 1.0220
## parent_GLuck 2.8031 2.5729 0.4215 0.4455
## parent_FPlans 2.4399 2.1100 0.3690 0.7884
## parent_WinArg 1.6496 1.6010 0.0603 0.9657
## parent_StrOpinion 1.9847 1.9463 0.0390 0.9896
## parent_MChange 1.5243 1.5678 -0.0520 0.8777
## parent_TrOthers 1.3760 1.7801 -0.4765 0.6362
## parent_OthHelp 1.5090 1.6471 -0.1605 0.8660
## parent_OthFair 1.2430 1.4297 -0.2700 0.6211
## parent_PID 3.8721 3.3043 0.2587 1.1994
## parent_SPID 2.0460 1.9233 0.1271 0.9016
## parent_Vote 0.9284 0.7698 0.5002 .
## parent_Persuade 0.5499 0.2685 0.5646 .
## parent_Rally 0.4015 0.1458 0.5600 .
## parent_OthAct 0.2225 0.1100 0.2925 .
## parent_PolClub 0.1049 0.0435 0.2190 .
## parent_Button 0.3529 0.2353 0.2525 .
## parent_Money 0.4169 0.1100 0.6780 .
## parent_Participate1 0.3414 0.1522 0.6559 1.6538
## parent_Participate2 0.2997 0.1289 0.5883 1.8223
## parent_ActFrq 2.9386 1.3836 0.4763 1.6300
## parent_GovtOpinion 1.6394 1.8440 -0.3004 0.9216
## parent_GovtCrook 2.0997 1.9591 0.1963 1.0419
## parent_GovtWaste 1.5090 1.7212 -0.3565 0.8245
## parent_TrGovt 2.0409 1.9923 0.0775 0.8877
## parent_GovtSmart 1.6061 1.5064 0.1140 1.0973
## parent_Govt4All 2.5396 2.4834 0.0688 0.8730
## parent_Employ 0.7340 0.6138 0.2614 .
## parent_EducHH 3.9591 2.2762 1.1479 1.3869
## parent_EducW 3.5320 2.3887 0.9430 1.3014
## parent_ChurchOrg 1.9949 1.6522 0.2974 1.1463
## parent_FratOrg 1.4143 1.2532 0.2068 1.2258
## parent_ProOrg 1.7391 1.1253 0.7113 3.9995
## parent_CivicOrg 1.2788 1.0716 0.3306 3.4592
## parent_CLOrg 1.0972 1.0460 0.1525 1.5396
## parent_NeighClub 1.3529 1.2123 0.1860 1.2337
## parent_SportClub 1.4220 1.2685 0.1753 1.3373
## parent_InfClub 1.5575 1.2737 0.3004 1.6388
## parent_FarmGr 1.7110 1.5038 0.3676 0.6868
## parent_WomenClub 1.7391 1.5652 0.2414 1.1819
## parent_MiscClub 0.1790 0.1304 0.1336 .
## parent_ClubLev 1.3785 1.2532 0.1517 1.3307
## parent_FInc 8.4399 6.6982 0.8738 0.7078
## parent_HHInc 7.9847 6.1176 0.8709 0.8069
## parent_OwnHome 0.8619 0.7673 0.2610 .
## parent_Senate 0.4885 0.1893 0.6161 .
## parent_Tito 0.6854 0.3197 0.7345 .
## parent_Court 0.3734 0.1739 0.4413 .
## parent_Govern 0.9795 0.9156 0.3485 .
## parent_CCamp 0.9668 0.7698 0.6539 .
## parent_FDR 0.9744 0.9207 0.2595 .
## parent_Knowledge 0.7447 0.5482 0.8978 0.8339
## parent_Gen 0.4680 0.3811 0.1749 .
## parent_Race 1.0665 1.1074 -0.1376 0.6215
## eCDF Mean eCDF Max Std. Pair Dist.
## distance 0.5702 0.9719 2.7795
## interviewid 0.0656 0.1407 1.1550
## student_vote 0.2711 0.2711 0.9331
## student_meeting 0.3606 0.3606 0.9554
## student_other 0.1841 0.1841 0.7260
## student_button 0.1867 0.1867 0.9691
## student_money 0.2020 0.2020 0.7975
## student_communicate 0.3606 0.3606 1.0676
## student_demonstrate 0.2916 0.2916 0.8087
## student_community 0.2148 0.2148 0.8778
## student_ppnscal 0.2302 0.4271 1.2363
## student_PubAff 0.0230 0.0230 0.3976
## student_Newspaper 0.0685 0.1535 0.9698
## student_Radio 0.0338 0.0588 1.0238
## student_TV 0.0183 0.0691 1.0513
## student_Magazine 0.1731 0.2711 1.0349
## student_FamTalk 0.0844 0.1407 1.0553
## student_FrTalk 0.1074 0.2072 1.0967
## student_AdultTalk 0.0288 0.0793 1.1089
## student_PID 0.0891 0.1483 1.1786
## student_SPID 0.0269 0.0486 1.2129
## student_GovtOpinion 0.0443 0.0793 1.0040
## student_GovtCrook 0.0213 0.0358 1.0550
## student_GovtWaste 0.0205 0.0409 1.0594
## student_TrGovt 0.0392 0.0767 1.0751
## student_GovtSmart 0.0153 0.0230 0.7669
## student_Govt4All 0.0341 0.0691 0.7565
## student_Cynic 0.0188 0.0767 1.1468
## student_LifeWish 0.0776 0.1176 0.9263
## student_GLuck 0.0742 0.1176 0.9329
## student_FPlans 0.1168 0.1765 1.0613
## student_EgoA 0.1049 0.1893 1.1101
## student_WinArg 0.1219 0.2123 1.0970
## student_StrOpinion 0.0597 0.0895 1.0791
## student_MChange 0.0375 0.0639 0.9329
## student_EgoB 0.0601 0.1432 1.1903
## student_TrOthers 0.0699 0.1074 0.9260
## student_OthHelp 0.0119 0.0256 1.0727
## student_OthFair 0.0452 0.0716 0.9399
## student_Trust 0.0448 0.0691 1.1187
## student_Senate 0.3555 0.3555 1.0791
## student_Tito 0.3478 0.3478 0.9591
## student_Court 0.3402 0.3402 1.0186
## student_Govern 0.1432 0.1432 0.7621
## student_CCamp 0.2072 0.2072 0.9386
## student_FDR 0.3299 0.3299 1.1004
## student_Knowledge 0.2463 0.5090 1.4639
## student_NextSch 0.2685 0.2685 1.3336
## student_GPA 0.0895 0.2967 1.1837
## student_SchOfficer 0.0955 0.2199 1.1791
## student_SchPublish 0.0371 0.0614 1.0070
## student_Hobby 0.0064 0.0102 0.7431
## student_SchClub 0.1292 0.2634 1.0256
## student_OccClub 0.0754 0.1279 1.0409
## student_NeighClub 0.0512 0.0716 0.8766
## student_RelClub 0.0217 0.0409 1.1318
## student_YouthOrg 0.0652 0.1151 0.8991
## student_MiscClub 0.1944 0.1944 0.9238
## student_ClubLev 0.1061 0.1662 0.9063
## student_Phone 0.0895 0.0895 0.5974
## student_Gen 0.1458 0.1458 1.1665
## student_Race 0.0102 0.0256 0.5200
## parent_Newspaper 0.1412 0.1918 0.9829
## parent_Radio 0.0256 0.0512 0.9726
## parent_TV 0.0266 0.0793 0.9983
## parent_Magazine 0.2302 0.2302 1.0366
## parent_LifeWish 0.0213 0.0332 0.9194
## parent_GLuck 0.0767 0.1304 0.9367
## parent_FPlans 0.1100 0.1739 0.9640
## parent_WinArg 0.0196 0.0537 0.9490
## parent_StrOpinion 0.0128 0.0256 0.9396
## parent_MChange 0.0179 0.0486 0.9702
## parent_TrOthers 0.1347 0.2046 1.0375
## parent_OthHelp 0.0460 0.0716 0.9688
## parent_OthFair 0.0622 0.0972 0.8396
## parent_PID 0.0811 0.1483 1.1138
## parent_SPID 0.0307 0.0435 1.1123
## parent_Vote 0.1586 0.1586 0.9036
## parent_Persuade 0.2813 0.2813 0.9958
## parent_Rally 0.2558 0.2558 0.9297
## parent_OthAct 0.1125 0.1125 0.7181
## parent_PolClub 0.0614 0.0614 0.4745
## parent_Button 0.1176 0.1176 0.9110
## parent_Money 0.3069 0.3069 0.9153
## parent_Participate1 0.1622 0.3069 1.1109
## parent_Participate2 0.1424 0.2737 1.0462
## parent_ActFrq 0.1296 0.3095 0.9761
## parent_GovtOpinion 0.0682 0.1355 1.0062
## parent_GovtCrook 0.0469 0.0844 1.0241
## parent_GovtWaste 0.0708 0.1509 1.1468
## parent_TrGovt 0.0162 0.0460 0.9916
## parent_GovtSmart 0.0332 0.0588 0.8738
## parent_Govt4All 0.0188 0.0435 0.9316
## parent_Employ 0.1202 0.1202 1.0621
## parent_EducHH 0.2805 0.4987 1.3363
## parent_EducW 0.1905 0.3708 1.3016
## parent_ChurchOrg 0.0857 0.2046 1.0430
## parent_FratOrg 0.0428 0.1228 0.6862
## parent_ProOrg 0.1535 0.3402 0.8772
## parent_CivicOrg 0.0518 0.1151 0.5020
## parent_CLOrg 0.0128 0.0460 0.4117
## parent_NeighClub 0.0377 0.1125 0.6528
## parent_SportClub 0.0384 0.0870 0.6603
## parent_InfClub 0.0710 0.1509 0.7605
## parent_FarmGr 0.0659 0.2353 1.1483
## parent_WomenClub 0.0435 0.1228 0.9301
## parent_MiscClub 0.0486 0.0486 0.7805
## parent_ClubLev 0.0313 0.0665 0.7276
## parent_FInc 0.1742 0.4118 1.2280
## parent_HHInc 0.1867 0.3657 1.2431
## parent_OwnHome 0.0946 0.0946 0.8677
## parent_Senate 0.2992 0.2992 0.9637
## parent_Tito 0.3657 0.3657 1.0735
## parent_Court 0.1995 0.1995 0.9617
## parent_Govern 0.0639 0.0639 0.5158
## parent_CCamp 0.1969 0.1969 0.8238
## parent_FDR 0.0537 0.0537 0.4820
## parent_Knowledge 0.1684 0.3632 1.2172
## parent_Gen 0.0870 0.0870 1.0288
## parent_Race 0.0136 0.0358 0.5677
##
## Sample Sizes:
## Control Treated
## All 451 803
## Matched 391 391
## Unmatched 0 412
## Discarded 60 0
# --------------------------------------------------
# construct a matched dataset from the matchit object
match_ps_att_all_data <- match.data(match_ps_att_all)
# specify linear model
lm_ps_att_all <- glm(student_ppnscal ~ ., # formula
data = match_ps_att_all_data, # data
weights = weights) # weights
# view summary results
lm_ps_att_all_summ <- summary(lm_ps_att_all)
print(lm_ps_att_all_summ)
##
## Call:
## glm(formula = student_ppnscal ~ ., data = match_ps_att_all_data,
## weights = weights)
##
## Coefficients: (1 not defined because of singularities)
## Estimate Std. Error
## (Intercept) -0.000000000000467336713 0.000000000000598355077
## interviewid 0.000000000000000005257 0.000000000000000023310
## college 0.000000000000021227951 0.000000000000222896228
## student_vote 0.999999999999988231636 0.000000000000034971333
## student_meeting 0.999999999999993671729 0.000000000000053330710
## student_other 1.000000000000017097435 0.000000000000036622202
## student_button 1.000000000000003996803 0.000000000000024056103
## student_money 1.000000000000000222045 0.000000000000027308378
## student_communicate 0.999999999999999888978 0.000000000000032378909
## student_demonstrate 0.999999999999986233234 0.000000000000065133538
## student_community 0.999999999999995115019 0.000000000000028473242
## student_PubAff 0.000000000000000854676 0.000000000000055599425
## student_Newspaper 0.000000000000000025023 0.000000000000009079015
## student_Radio -0.000000000000000070020 0.000000000000005784279
## student_TV -0.000000000000002029280 0.000000000000010357198
## student_Magazine 0.000000000000004508419 0.000000000000019078272
## student_FamTalk -0.000000000000000960169 0.000000000000012261791
## student_FrTalk 0.000000000000001485579 0.000000000000019309262
## student_AdultTalk -0.000000000000001541030 0.000000000000012441770
## student_PID -0.000000000000001014969 0.000000000000009319021
## student_SPID -0.000000000000001033180 0.000000000000010073936
## student_GovtOpinion 0.000000000000003307128 0.000000000000019584184
## student_GovtCrook 0.000000000000004028000 0.000000000000021069951
## student_GovtWaste -0.000000000000003135289 0.000000000000018685774
## student_TrGovt -0.000000000000005484519 0.000000000000027054750
## student_GovtSmart -0.000000000000002128815 0.000000000000017093272
## student_Govt4All 0.000000000000002569886 0.000000000000016086137
## student_Cynic 0.000000000000003459224 0.000000000000017063193
## student_LifeWish -0.000000000000005167963 0.000000000000022688212
## student_GLuck 0.000000000000000016129 0.000000000000018447273
## student_FPlans -0.000000000000001127863 0.000000000000017539912
## student_EgoA -0.000000000000003555933 0.000000000000029063353
## student_WinArg 0.000000000000003391675 0.000000000000013941467
## student_StrOpinion 0.000000000000000054133 0.000000000000031017583
## student_MChange -0.000000000000000128755 0.000000000000019250249
## student_EgoB 0.000000000000003128401 0.000000000000033483260
## student_TrOthers 0.000000000000002589946 0.000000000000041180796
## student_OthHelp 0.000000000000000639587 0.000000000000040446410
## student_OthFair 0.000000000000001410270 0.000000000000041287475
## student_Trust 0.000000000000004252327 0.000000000000077934739
## student_Senate -0.000000036785629913516 0.000000183008587032102
## student_Tito -0.000000036785626329645 0.000000183008578932774
## student_Court -0.000000036785618085112 0.000000183008579503743
## student_Govern -0.000000036785616686437 0.000000183008576049371
## student_CCamp -0.000000036785624234358 0.000000183008589032323
## student_FDR -0.000000036785619948005 0.000000183008576857748
## student_Knowledge 0.000000220713722502075 0.000001098051431596859
## student_NextSch -0.000000000000012929637 0.000000000000092039377
## student_GPA 0.000000000000005669661 0.000000000000027726923
## student_SchOfficer 0.000000000000000907171 0.000000000000013265890
## student_SchPublish 0.000000000000001099517 0.000000000000008628214
## student_Hobby 0.000000000000002180472 0.000000000000013535125
## student_SchClub -0.000000000000001502756 0.000000000000010386618
## student_OccClub -0.000000000000001341477 0.000000000000009193614
## student_NeighClub -0.000000000000001810576 0.000000000000013708490
## student_RelClub 0.000000000000001181166 0.000000000000009624071
## student_YouthOrg 0.000000000000000839019 0.000000000000011278648
## student_MiscClub -0.000000000000007356025 0.000000000000066595995
## student_ClubLev 0.000000000000002104993 0.000000000000022870918
## student_Phone -0.000000000000002932004 0.000000000000050898395
## student_Gen -0.000000000000004066608 0.000000000000027146882
## student_Race -0.000000000000006485903 0.000000000000087240896
## parent_Newspaper 0.000000000000000637889 0.000000000000008322598
## parent_Radio 0.000000000000000486200 0.000000000000005864673
## parent_TV 0.000000000000000872921 0.000000000000008060395
## parent_Magazine 0.000000000000002407722 0.000000000000023985717
## parent_LifeWish 0.000000000000003691782 0.000000000000011281565
## parent_GLuck -0.000000000000000073640 0.000000000000021987351
## parent_FPlans 0.000000000000002493646 0.000000000000012152195
## parent_WinArg -0.000000000000001071779 0.000000000000013620128
## parent_StrOpinion 0.000000000000000957238 0.000000000000012415191
## parent_MChange 0.000000000000000003136 0.000000000000012542286
## parent_TrOthers 0.000000000000000324321 0.000000000000013724877
## parent_OthHelp -0.000000000000002490794 0.000000000000017330206
## parent_OthFair 0.000000000000001953755 0.000000000000018609645
## parent_PID 0.000000000000001203066 0.000000000000007248542
## parent_SPID -0.000000000000002191755 0.000000000000013440996
## parent_Vote -0.000000000000004964390 0.000000000000030522667
## parent_Persuade -0.000000021552366139835 0.000000290563498894735
## parent_Rally -0.000000058535814133042 0.000000409609680078396
## parent_OthAct -0.000000058535805868920 0.000000409609676401244
## parent_PolClub -0.000000058535810561123 0.000000409609661560984
## parent_Button -0.000000058535814452570 0.000000409609678177142
## parent_Money -0.000000058535814237778 0.000000409609678876457
## parent_Participate1 0.000000129314173338243 0.000001743380931988960
## parent_Participate2 0.000000184917258418568 0.000002555850137135070
## parent_ActFrq -0.000000000000000801416 0.000000000000005393476
## parent_GovtOpinion 0.000000000000002758845 0.000000000000022551077
## parent_GovtCrook 0.000000000000001472077 0.000000000000019888266
## parent_GovtWaste 0.000000000000006117350 0.000000000000026642312
## parent_TrGovt 0.000000000000001479073 0.000000000000019113789
## parent_GovtSmart 0.000000000000000348870 0.000000000000013337483
## parent_Govt4All 0.000000000000001346353 0.000000000000015893397
## parent_Employ 0.000000000000001095828 0.000000000000027169742
## parent_EducHH -0.000000000000000831892 0.000000000000012909179
## parent_EducW -0.000000000000000912277 0.000000000000013665592
## parent_ChurchOrg -0.000000000000004439233 0.000000000000012627045
## parent_FratOrg 0.000000000000001053303 0.000000000000014320561
## parent_ProOrg -0.000000000000007841262 0.000000000000026984083
## parent_CivicOrg 0.000000000000002401039 0.000000000000018052746
## parent_CLOrg -0.000000000000001296673 0.000000000000028572099
## parent_NeighClub 0.000000000000001053527 0.000000000000014311176
## parent_SportClub -0.000000000000000638515 0.000000000000011936672
## parent_InfClub 0.000000000000001006711 0.000000000000011898420
## parent_FarmGr -0.000000000000000904545 0.000000000000017239725
## parent_WomenClub 0.000000000000002320559 0.000000000000019771674
## parent_MiscClub 0.000000000000004069236 0.000000000000064100410
## parent_ClubLev -0.000000000000000693158 0.000000000000026273298
## parent_FInc -0.000000000000000053829 0.000000000000011465350
## parent_HHInc -0.000000000000000602790 0.000000000000012661985
## parent_OwnHome -0.000000000000003632828 0.000000000000033130465
## parent_Senate 0.000000040948677964911 0.000000138201762626494
## parent_Tito 0.000000040948679369813 0.000000138201769628647
## parent_Court 0.000000040948675193991 0.000000138201767245337
## parent_Govern 0.000000040948672144537 0.000000138201766926504
## parent_CCamp 0.000000040948677881379 0.000000138201771159333
## parent_FDR 0.000000040948690535645 0.000000138201778500832
## parent_Knowledge -0.000000245692075296269 0.000000829210623783001
## parent_Gen 0.000000000000002193021 0.000000000000033276125
## parent_Race 0.000000000000002468833 0.000000000000067604357
## distance 0.000000000000018101739 0.000000000000079045220
## weights NA NA
## subclass2 0.000000000000350260902 0.000000000000214668038
## subclass3 0.000000000000302598060 0.000000000000262219957
## subclass4 0.000000000000304827879 0.000000000000257535050
## subclass5 0.000000000000325711520 0.000000000000251444397
## subclass6 0.000000000000370593392 0.000000000000213030805
## subclass7 0.000000000000346936056 0.000000000000191880398
## subclass8 0.000000000000326667156 0.000000000000189386155
## subclass9 0.000000000000320380072 0.000000000000245477804
## subclass10 0.000000000000343103269 0.000000000000187384343
## subclass11 0.000000000000334608146 0.000000000000218854390
## subclass12 0.000000000000323270553 0.000000000000234661162
## subclass13 0.000000000000327577565 0.000000000000289322225
## subclass14 0.000000000000343631220 0.000000000000190782279
## subclass15 0.000000000000318381622 0.000000000000211466675
## subclass16 0.000000000000330413093 0.000000000000221977378
## subclass17 0.000000000000318053256 0.000000000000277989671
## subclass18 0.000000000000329391728 0.000000000000221257435
## subclass19 0.000000000000330172294 0.000000000000237594749
## subclass20 0.000000000000324075608 0.000000000000212111023
## subclass21 0.000000000000320437430 0.000000000000232480469
## subclass22 0.000000000000298393653 0.000000000000231460983
## subclass23 0.000000000000324072013 0.000000000000195942874
## subclass24 0.000000000000329966102 0.000000000000203704519
## subclass25 0.000000000000328401799 0.000000000000206863425
## subclass26 0.000000000000329887511 0.000000000000225310748
## subclass27 0.000000000000326595996 0.000000000000255953218
## subclass28 0.000000000000334824042 0.000000000000188303106
## subclass29 0.000000000000342771519 0.000000000000209829148
## subclass30 0.000000000000343246099 0.000000000000182028971
## subclass31 0.000000000000333316465 0.000000000000209329082
## subclass32 0.000000000000350523422 0.000000000000194808967
## subclass33 0.000000000000329987962 0.000000000000194055609
## subclass34 0.000000000000324017231 0.000000000000271985206
## subclass35 0.000000000000323265476 0.000000000000276133659
## subclass36 0.000000000000324323197 0.000000000000210874053
## subclass37 0.000000000000326435781 0.000000000000257429252
## subclass38 0.000000000000311224453 0.000000000000261689091
## subclass39 0.000000000000324314947 0.000000000000257721646
## subclass40 0.000000000000319530426 0.000000000000235743164
## subclass41 0.000000000000344483489 0.000000000000191140483
## subclass42 0.000000000000319743445 0.000000000000257449683
## subclass43 0.000000000000343216604 0.000000000000192444329
## subclass44 0.000000000000326898124 0.000000000000216236881
## subclass45 0.000000000000331547507 0.000000000000235587047
## subclass46 0.000000000000332481875 0.000000000000220987391
## subclass47 0.000000000000326811862 0.000000000000194812993
## subclass48 0.000000000000300060888 0.000000000000215987061
## subclass49 0.000000000000338297865 0.000000000000190129638
## subclass50 0.000000000000322480120 0.000000000000223169704
## subclass51 0.000000000000355834014 0.000000000000192140326
## subclass52 0.000000000000337098943 0.000000000000181397830
## subclass53 0.000000000000333161053 0.000000000000238716645
## subclass54 0.000000000000379301471 0.000000000000266014096
## subclass55 0.000000000000312103319 0.000000000000249857518
## subclass56 0.000000000000331940504 0.000000000000193055098
## subclass57 0.000000000000312297827 0.000000000000190092058
## subclass58 0.000000000000327225164 0.000000000000189246741
## subclass59 0.000000000000340878280 0.000000000000194962212
## subclass60 0.000000000000351905343 0.000000000000197919312
## subclass61 0.000000000000321099120 0.000000000000284102040
## subclass62 0.000000000000319117958 0.000000000000250021205
## subclass63 0.000000000000321745150 0.000000000000257405102
## subclass64 0.000000000000333511958 0.000000000000255082383
## subclass65 0.000000000000330732058 0.000000000000218907461
## subclass66 0.000000000000338891937 0.000000000000205185532
## subclass67 0.000000000000343673887 0.000000000000233681973
## subclass68 0.000000000000345432038 0.000000000000204907599
## subclass69 0.000000000000322070886 0.000000000000279908078
## subclass70 0.000000000000347521725 0.000000000000195070362
## subclass71 0.000000000000325134764 0.000000000000208328411
## subclass72 0.000000000000309805118 0.000000000000235171004
## subclass73 0.000000000000336427346 0.000000000000244329183
## subclass74 0.000000000000348690812 0.000000000000190451337
## subclass75 0.000000000000332158116 0.000000000000209839541
## subclass76 0.000000000000340121336 0.000000000000216343993
## subclass77 0.000000000000337081816 0.000000000000257386477
## subclass78 0.000000000000296855758 0.000000000000286821755
## subclass79 0.000000000000316379465 0.000000000000194151918
## subclass80 0.000000000000311900987 0.000000000000243293737
## subclass81 0.000000000000327358405 0.000000000000204839153
## subclass82 0.000000000000325406114 0.000000000000226369665
## subclass83 0.000000000000319327671 0.000000000000258462655
## subclass84 0.000000000000313061932 0.000000000000277002957
## subclass85 0.000000000000339916762 0.000000000000215966951
## subclass86 0.000000000000335107534 0.000000000000206913970
## subclass87 0.000000000000324142889 0.000000000000216627133
## subclass88 0.000000000000329493664 0.000000000000200434065
## subclass89 0.000000000000329582846 0.000000000000184491853
## subclass90 0.000000000000313711625 0.000000000000272044398
## subclass91 0.000000000000345006378 0.000000000000194983595
## subclass92 0.000000000000369299881 0.000000000000188855164
## subclass93 0.000000000000328622947 0.000000000000194314492
## subclass94 0.000000000000332326618 0.000000000000279444012
## subclass95 0.000000000000339845980 0.000000000000231677322
## subclass96 0.000000000000331353251 0.000000000000249100408
## subclass97 0.000000000000337080584 0.000000000000190251591
## subclass98 0.000000000000312068119 0.000000000000276097357
## subclass99 0.000000000000359251441 0.000000000000190892678
## subclass100 0.000000000000316134881 0.000000000000274521457
## subclass101 0.000000000000322747631 0.000000000000254341369
## subclass102 0.000000000000335351599 0.000000000000216164979
## subclass103 0.000000000000328528357 0.000000000000222707527
## subclass104 0.000000000000307405938 0.000000000000246078750
## subclass105 0.000000000000343419684 0.000000000000196330401
## subclass106 0.000000000000355767242 0.000000000000226742067
## subclass107 0.000000000000332172806 0.000000000000208996183
## subclass108 0.000000000000335608769 0.000000000000240529296
## subclass109 0.000000000000327370394 0.000000000000258893748
## subclass110 0.000000000000344564984 0.000000000000193626215
## subclass111 0.000000000000327627594 0.000000000000211696969
## subclass112 0.000000000000341071572 0.000000000000197363804
## subclass113 0.000000000000338011192 0.000000000000223080301
## subclass114 0.000000000000335060430 0.000000000000186717866
## subclass115 0.000000000000323420881 0.000000000000196412817
## subclass116 0.000000000000337310751 0.000000000000218808849
## subclass117 0.000000000000351167389 0.000000000000232481137
## subclass118 0.000000000000336019850 0.000000000000208612747
## subclass119 0.000000000000366880044 0.000000000000184400406
## subclass120 0.000000000000336650223 0.000000000000180707945
## subclass121 0.000000000000331429806 0.000000000000194937981
## subclass122 0.000000000000305494356 0.000000000000275855480
## subclass123 0.000000000000328185216 0.000000000000232238687
## subclass124 0.000000000000355027664 0.000000000000194294344
## subclass125 0.000000000000330157807 0.000000000000244338773
## subclass126 0.000000000000331474027 0.000000000000228946601
## subclass127 0.000000000000323068558 0.000000000000277083725
## subclass128 0.000000000000323274169 0.000000000000235843540
## subclass129 0.000000000000352770831 0.000000000000182802989
## subclass130 0.000000000000334930240 0.000000000000231748000
## subclass131 0.000000000000318252110 0.000000000000261013421
## subclass132 0.000000000000338832448 0.000000000000202067273
## subclass133 0.000000000000334080837 0.000000000000216321236
## subclass134 0.000000000000330416834 0.000000000000208847210
## subclass135 0.000000000000321933163 0.000000000000256311732
## subclass136 0.000000000000346757953 0.000000000000178345559
## subclass137 0.000000000000335523431 0.000000000000188599328
## subclass138 0.000000000000349230340 0.000000000000196211244
## subclass139 0.000000000000326642797 0.000000000000287620859
## subclass140 0.000000000000319621856 0.000000000000251940658
## subclass141 0.000000000000324162604 0.000000000000212949276
## subclass142 0.000000000000332760725 0.000000000000265716677
## subclass143 0.000000000000335613980 0.000000000000231517808
## subclass144 0.000000000000334143385 0.000000000000239812289
## subclass145 0.000000000000313801266 0.000000000000255200214
## subclass146 0.000000000000351473611 0.000000000000205677786
## subclass147 0.000000000000343193937 0.000000000000207041124
## subclass148 0.000000000000343261249 0.000000000000213168361
## subclass149 0.000000000000342683738 0.000000000000237578497
## subclass150 0.000000000000333742964 0.000000000000225652354
## subclass151 0.000000000000325979659 0.000000000000242856020
## subclass152 0.000000000000320339583 0.000000000000243004712
## subclass153 0.000000000000310562926 0.000000000000255513255
## subclass154 0.000000000000328822965 0.000000000000215909856
## subclass155 0.000000000000322554156 0.000000000000239399783
## subclass156 0.000000000000327548036 0.000000000000197200691
## subclass157 0.000000000000310309633 0.000000000000268295669
## subclass158 0.000000000000334657037 0.000000000000227893207
## subclass159 0.000000000000337347353 0.000000000000185108428
## subclass160 0.000000000000324517314 0.000000000000252239912
## subclass161 0.000000000000339360209 0.000000000000275693909
## subclass162 0.000000000000319115504 0.000000000000217286968
## subclass163 0.000000000000317689163 0.000000000000241611514
## subclass164 0.000000000000313954873 0.000000000000273707446
## subclass165 0.000000000000308625770 0.000000000000262848021
## subclass166 0.000000000000316154480 0.000000000000229925935
## subclass167 0.000000000000350472588 0.000000000000182643046
## subclass168 0.000000000000349325468 0.000000000000200325119
## subclass169 0.000000000000364143907 0.000000000000205386041
## subclass170 0.000000000000332568717 0.000000000000266809269
## subclass171 0.000000000000315188104 0.000000000000235091745
## subclass172 0.000000000000321698306 0.000000000000238788573
## subclass173 0.000000000000348062167 0.000000000000197000355
## subclass174 0.000000000000330794232 0.000000000000216000436
## subclass175 0.000000000000332006388 0.000000000000207459484
## subclass176 0.000000000000340777161 0.000000000000268320555
## subclass177 0.000000000000330868754 0.000000000000243717104
## subclass178 0.000000000000322430854 0.000000000000218203562
## subclass179 0.000000000000324385855 0.000000000000225133914
## subclass180 0.000000000000319812668 0.000000000000255944784
## subclass181 0.000000000000338248470 0.000000000000221923687
## subclass182 0.000000000000341300723 0.000000000000182654971
## subclass183 0.000000000000315554948 0.000000000000272228380
## subclass184 0.000000000000341439142 0.000000000000201399772
## subclass185 0.000000000000322990725 0.000000000000230082361
## subclass186 0.000000000000341518007 0.000000000000236124437
## subclass187 0.000000000000325748670 0.000000000000196045666
## subclass188 0.000000000000330044340 0.000000000000271185517
## subclass189 0.000000000000322322763 0.000000000000207112332
## subclass190 0.000000000000298815500 0.000000000000233085483
## subclass191 0.000000000000328654116 0.000000000000218763692
## subclass192 0.000000000000347467832 0.000000000000197349670
## subclass193 0.000000000000320633376 0.000000000000254039407
## subclass194 0.000000000000334541349 0.000000000000246780013
## subclass195 0.000000000000321546005 0.000000000000268227071
## subclass196 0.000000000000314348624 0.000000000000224890354
## subclass197 0.000000000000327847845 0.000000000000257349512
## subclass198 0.000000000000322210314 0.000000000000199841428
## subclass199 0.000000000000334692307 0.000000000000272481497
## subclass200 0.000000000000340257315 0.000000000000230806998
## subclass201 0.000000000000313165563 0.000000000000203428182
## subclass202 0.000000000000337842948 0.000000000000226095396
## subclass203 0.000000000000337796354 0.000000000000195811247
## subclass204 0.000000000000331033137 0.000000000000218114119
## subclass205 0.000000000000332176178 0.000000000000247126205
## subclass206 0.000000000000328450489 0.000000000000251495914
## subclass207 0.000000000000339344001 0.000000000000210252418
## subclass208 0.000000000000317450975 0.000000000000234149862
## subclass209 0.000000000000337119899 0.000000000000203476068
## subclass210 0.000000000000313509719 0.000000000000270750507
## subclass211 0.000000000000333381632 0.000000000000221326930
## subclass212 0.000000000000322293290 0.000000000000241280539
## subclass213 0.000000000000325950509 0.000000000000225060986
## subclass214 0.000000000000351070953 0.000000000000195033190
## subclass215 0.000000000000321534054 0.000000000000192610942
## subclass216 0.000000000000355842459 0.000000000000185097911
## subclass217 0.000000000000325147546 0.000000000000220666840
## subclass218 0.000000000000325713076 0.000000000000215574041
## subclass219 0.000000000000306615118 0.000000000000242219193
## subclass220 0.000000000000319359722 0.000000000000209878091
## subclass221 0.000000000000326336922 0.000000000000228913875
## subclass222 0.000000000000302234237 0.000000000000271328136
## subclass223 0.000000000000344074355 0.000000000000188364783
## subclass224 0.000000000000310875164 0.000000000000255987820
## subclass225 0.000000000000329352443 0.000000000000242710967
## subclass226 0.000000000000325003409 0.000000000000208917254
## subclass227 0.000000000000326671905 0.000000000000272330621
## subclass228 0.000000000000341467948 0.000000000000193346575
## subclass229 0.000000000000329188397 0.000000000000231156218
## subclass230 0.000000000000315432354 0.000000000000277201231
## subclass231 0.000000000000333956921 0.000000000000196129260
## subclass232 0.000000000000352251269 0.000000000000247854222
## subclass233 0.000000000000337454341 0.000000000000208513617
## subclass234 0.000000000000327954031 0.000000000000261187523
## subclass235 0.000000000000347598585 0.000000000000196050362
## subclass236 0.000000000000341676001 0.000000000000186636352
## subclass237 0.000000000000326218915 0.000000000000205911549
## subclass238 0.000000000000333570704 0.000000000000183999031
## subclass239 0.000000000000335306141 0.000000000000219774490
## subclass240 0.000000000000330100599 0.000000000000200602028
## subclass241 0.000000000000332035896 0.000000000000222995852
## subclass242 0.000000000000309727483 0.000000000000244064804
## subclass243 0.000000000000343682588 0.000000000000196137293
## subclass244 0.000000000000338428579 0.000000000000258190720
## subclass245 0.000000000000348090662 0.000000000000189082084
## subclass246 0.000000000000329469269 0.000000000000231457150
## subclass247 0.000000000000336218289 0.000000000000211045887
## subclass248 0.000000000000325879343 0.000000000000208092292
## subclass249 0.000000000000338393065 0.000000000000194051954
## subclass250 0.000000000000336134384 0.000000000000255510007
## subclass251 0.000000000000324664598 0.000000000000282622543
## subclass252 0.000000000000330123836 0.000000000000229037712
## subclass253 0.000000000000322745988 0.000000000000194608643
## subclass254 0.000000000000318697472 0.000000000000243741857
## subclass255 0.000000000000341826503 0.000000000000214380842
## subclass256 0.000000000000316926773 0.000000000000220852202
## subclass257 0.000000000000346029278 0.000000000000195132474
## subclass258 0.000000000000326493777 0.000000000000210190053
## subclass259 0.000000000000327873742 0.000000000000230365629
## subclass260 0.000000000000337899133 0.000000000000200778209
## subclass261 0.000000000000319400737 0.000000000000260636143
## subclass262 0.000000000000337805315 0.000000000000195200136
## subclass263 0.000000000000321024893 0.000000000000234393795
## subclass264 0.000000000000327832051 0.000000000000248659954
## subclass265 0.000000000000337143490 0.000000000000212713227
## subclass266 0.000000000000328332934 0.000000000000227452399
## subclass267 0.000000000000327768384 0.000000000000204206471
## subclass268 0.000000000000338427254 0.000000000000194532888
## subclass269 0.000000000000331308215 0.000000000000205399424
## subclass270 0.000000000000331366752 0.000000000000216826931
## subclass271 0.000000000000346253964 0.000000000000198738746
## subclass272 0.000000000000355630489 0.000000000000194063237
## subclass273 0.000000000000314691202 0.000000000000256704009
## subclass274 0.000000000000324207908 0.000000000000243389412
## subclass275 0.000000000000332433868 0.000000000000210021786
## subclass276 0.000000000000322535991 0.000000000000191430571
## subclass277 0.000000000000333157016 0.000000000000255642151
## subclass278 0.000000000000336091692 0.000000000000205690725
## subclass279 0.000000000000304247866 0.000000000000263487199
## subclass280 0.000000000000333196074 0.000000000000218194962
## subclass281 0.000000000000309875745 0.000000000000248803813
## subclass282 0.000000000000336410913 0.000000000000203514685
## subclass283 0.000000000000340495350 0.000000000000191254103
## subclass284 0.000000000000318690842 0.000000000000241967492
## subclass285 0.000000000000325360171 0.000000000000212685489
## subclass286 0.000000000000327257475 0.000000000000197130164
## subclass287 0.000000000000339951458 0.000000000000187734279
## subclass288 0.000000000000342377762 0.000000000000190793630
## subclass289 0.000000000000335567703 0.000000000000225224862
## subclass290 0.000000000000334163911 0.000000000000236749600
## subclass291 0.000000000000318159166 0.000000000000248439750
## subclass292 0.000000000000348122558 0.000000000000209001937
## subclass293 0.000000000000337307693 0.000000000000189515521
## subclass294 0.000000000000315044227 0.000000000000264387502
## subclass295 0.000000000000352930221 0.000000000000186793590
## subclass296 0.000000000000335959636 0.000000000000204137811
## subclass297 0.000000000000336259329 0.000000000000208228457
## subclass298 0.000000000000331847418 0.000000000000209720749
## subclass299 0.000000000000331425291 0.000000000000197894267
## subclass300 0.000000000000336060510 0.000000000000224462646
## subclass301 0.000000000000335012605 0.000000000000198172732
## subclass302 0.000000000000335147971 0.000000000000232019980
## subclass303 0.000000000000329898905 0.000000000000255923375
## subclass304 0.000000000000325225105 0.000000000000237273710
## subclass305 0.000000000000340853103 0.000000000000219182460
## subclass306 0.000000000000319434502 0.000000000000245889161
## subclass307 0.000000000000342916377 0.000000000000193510266
## subclass308 0.000000000000336507672 0.000000000000227352168
## subclass309 0.000000000000341068211 0.000000000000188496789
## subclass310 0.000000000000315972262 0.000000000000238054442
## subclass311 0.000000000000335214053 0.000000000000185107974
## subclass312 0.000000000000331174314 0.000000000000193558528
## subclass313 0.000000000000333509716 0.000000000000230943775
## subclass314 0.000000000000321303823 0.000000000000227418968
## subclass315 0.000000000000326608235 0.000000000000187502546
## subclass316 0.000000000000339528883 0.000000000000216923322
## subclass317 0.000000000000328444274 0.000000000000203050048
## subclass318 0.000000000000333349176 0.000000000000196648707
## subclass319 0.000000000000325358095 0.000000000000221819605
## subclass320 0.000000000000326248362 0.000000000000203310542
## subclass321 0.000000000000358119268 0.000000000000191029004
## subclass322 0.000000000000343903864 0.000000000000185350313
## subclass323 0.000000000000315922415 0.000000000000273913213
## subclass324 0.000000000000330473581 0.000000000000198499380
## subclass325 0.000000000000330119112 0.000000000000247074530
## subclass326 0.000000000000325072264 0.000000000000256958177
## subclass327 0.000000000000361717851 0.000000000000205305341
## subclass328 0.000000000000351753332 0.000000000000201730307
## subclass329 0.000000000000369777876 0.000000000000193569698
## subclass330 0.000000000000347310218 0.000000000000190169075
## subclass331 0.000000000000322692138 0.000000000000212825399
## subclass332 0.000000000000314844735 0.000000000000257573672
## subclass333 0.000000000000325868494 0.000000000000206755192
## subclass334 0.000000000000314140499 0.000000000000237175544
## subclass335 0.000000000000323494669 0.000000000000194082934
## subclass336 0.000000000000324795692 0.000000000000193479427
## subclass337 0.000000000000339203351 0.000000000000211003014
## subclass338 0.000000000000339970596 0.000000000000199482437
## subclass339 0.000000000000320348966 0.000000000000269735889
## subclass340 0.000000000000355482625 0.000000000000200567345
## subclass341 0.000000000000344822635 0.000000000000199801702
## subclass342 0.000000000000322435758 0.000000000000202709254
## subclass343 0.000000000000284073174 0.000000000000245653611
## subclass344 0.000000000000336741392 0.000000000000227413797
## subclass345 0.000000000000317346978 0.000000000000230367693
## subclass346 0.000000000000324407260 0.000000000000201384999
## subclass347 0.000000000000343332343 0.000000000000213853787
## subclass348 0.000000000000340066607 0.000000000000220782401
## subclass349 0.000000000000346769721 0.000000000000182955995
## subclass350 0.000000000000326509918 0.000000000000252291124
## subclass351 0.000000000000340600830 0.000000000000262348800
## subclass352 0.000000000000344584537 0.000000000000193010462
## subclass353 0.000000000000351825537 0.000000000000185726500
## subclass354 0.000000000000315332686 0.000000000000278810561
## subclass355 0.000000000000325008847 0.000000000000195179987
## subclass356 0.000000000000333471779 0.000000000000217148028
## subclass357 0.000000000000317723696 0.000000000000263469467
## subclass358 0.000000000000337155791 0.000000000000251733118
## subclass359 0.000000000000323775184 0.000000000000219920662
## subclass360 0.000000000000317058535 0.000000000000189691909
## subclass361 0.000000000000333268758 0.000000000000186953930
## subclass362 0.000000000000330984916 0.000000000000211236366
## subclass363 0.000000000000330359388 0.000000000000222623019
## subclass364 0.000000000000334893520 0.000000000000188416048
## subclass365 0.000000000000373119600 0.000000000000218279835
## subclass366 0.000000000000326572931 0.000000000000250890774
## subclass367 0.000000000000315457936 0.000000000000204815718
## subclass368 0.000000000000354636622 0.000000000000250233380
## subclass369 0.000000000000327798855 0.000000000000245796098
## subclass370 0.000000000000318609457 0.000000000000210820129
## subclass371 0.000000000000336831442 0.000000000000191039254
## subclass372 0.000000000000342374422 0.000000000000219967628
## subclass373 0.000000000000332454023 0.000000000000211230325
## subclass374 0.000000000000312770695 0.000000000000222828864
## subclass375 0.000000000000325364185 0.000000000000262159555
## subclass376 0.000000000000328053593 0.000000000000215245540
## subclass377 0.000000000000348824359 0.000000000000189133985
## subclass378 0.000000000000342219873 0.000000000000186398321
## subclass379 0.000000000000328220138 0.000000000000198263885
## subclass380 0.000000000000345913886 0.000000000000197616377
## subclass381 0.000000000000354159653 0.000000000000187399078
## subclass382 0.000000000000340857655 0.000000000000182084583
## subclass383 0.000000000000329085012 0.000000000000203068728
## subclass384 0.000000000000326620555 0.000000000000229605665
## subclass385 0.000000000000312227531 0.000000000000255093709
## subclass386 0.000000000000358152007 0.000000000000185494033
## subclass387 0.000000000000346585505 0.000000000000191041697
## subclass388 0.000000000000325871536 0.000000000000231213383
## subclass389 0.000000000000343480746 0.000000000000231217742
## subclass390 0.000000000000354347783 0.000000000000194920341
## subclass391 0.000000000000317192533 0.000000000000275722653
## t value Pr(>|t|)
## (Intercept) -0.781 0.4355
## interviewid 0.226 0.8218
## college 0.095 0.9242
## student_vote 28594849142673.191 <0.0000000000000002 ***
## student_meeting 18750922372107.137 <0.0000000000000002 ***
## student_other 27305840590733.695 <0.0000000000000002 ***
## student_button 41569492627847.867 <0.0000000000000002 ***
## student_money 36618798222856.367 <0.0000000000000002 ***
## student_communicate 30884302092500.609 <0.0000000000000002 ***
## student_demonstrate 15353073492813.721 <0.0000000000000002 ***
## student_community 35120693857955.328 <0.0000000000000002 ***
## student_PubAff 0.015 0.9877
## student_Newspaper 0.003 0.9978
## student_Radio -0.012 0.9904
## student_TV -0.196 0.8448
## student_Magazine 0.236 0.8134
## student_FamTalk -0.078 0.9376
## student_FrTalk 0.077 0.9387
## student_AdultTalk -0.124 0.9015
## student_PID -0.109 0.9134
## student_SPID -0.103 0.9184
## student_GovtOpinion 0.169 0.8660
## student_GovtCrook 0.191 0.8485
## student_GovtWaste -0.168 0.8669
## student_TrGovt -0.203 0.8395
## student_GovtSmart -0.125 0.9010
## student_Govt4All 0.160 0.8732
## student_Cynic 0.203 0.8395
## student_LifeWish -0.228 0.8200
## student_GLuck 0.001 0.9993
## student_FPlans -0.064 0.9488
## student_EgoA -0.122 0.9027
## student_WinArg 0.243 0.8080
## student_StrOpinion 0.002 0.9986
## student_MChange -0.007 0.9947
## student_EgoB 0.093 0.9256
## student_TrOthers 0.063 0.9499
## student_OthHelp 0.016 0.9874
## student_OthFair 0.034 0.9728
## student_Trust 0.055 0.9565
## student_Senate -0.201 0.8408
## student_Tito -0.201 0.8408
## student_Court -0.201 0.8408
## student_Govern -0.201 0.8408
## student_CCamp -0.201 0.8408
## student_FDR -0.201 0.8408
## student_Knowledge 0.201 0.8408
## student_NextSch -0.140 0.8884
## student_GPA 0.204 0.8381
## student_SchOfficer 0.068 0.9455
## student_SchPublish 0.127 0.8987
## student_Hobby 0.161 0.8721
## student_SchClub -0.145 0.8851
## student_OccClub -0.146 0.8841
## student_NeighClub -0.132 0.8950
## student_RelClub 0.123 0.9024
## student_YouthOrg 0.074 0.9408
## student_MiscClub -0.110 0.9121
## student_ClubLev 0.092 0.9267
## student_Phone -0.058 0.9541
## student_Gen -0.150 0.8810
## student_Race -0.074 0.9408
## parent_Newspaper 0.077 0.9390
## parent_Radio 0.083 0.9340
## parent_TV 0.108 0.9138
## parent_Magazine 0.100 0.9201
## parent_LifeWish 0.327 0.7437
## parent_GLuck -0.003 0.9973
## parent_FPlans 0.205 0.8376
## parent_WinArg -0.079 0.9373
## parent_StrOpinion 0.077 0.9386
## parent_MChange 0.000 0.9998
## parent_TrOthers 0.024 0.9812
## parent_OthHelp -0.144 0.8858
## parent_OthFair 0.105 0.9165
## parent_PID 0.166 0.8683
## parent_SPID -0.163 0.8706
## parent_Vote -0.163 0.8709
## parent_Persuade -0.074 0.9409
## parent_Rally -0.143 0.8865
## parent_OthAct -0.143 0.8865
## parent_PolClub -0.143 0.8865
## parent_Button -0.143 0.8865
## parent_Money -0.143 0.8865
## parent_Participate1 0.074 0.9409
## parent_Participate2 0.072 0.9424
## parent_ActFrq -0.149 0.8820
## parent_GovtOpinion 0.122 0.9027
## parent_GovtCrook 0.074 0.9411
## parent_GovtWaste 0.230 0.8186
## parent_TrGovt 0.077 0.9384
## parent_GovtSmart 0.026 0.9792
## parent_Govt4All 0.085 0.9326
## parent_Employ 0.040 0.9679
## parent_EducHH -0.064 0.9487
## parent_EducW -0.067 0.9468
## parent_ChurchOrg -0.352 0.7254
## parent_FratOrg 0.074 0.9414
## parent_ProOrg -0.291 0.7716
## parent_CivicOrg 0.133 0.8943
## parent_CLOrg -0.045 0.9638
## parent_NeighClub 0.074 0.9414
## parent_SportClub -0.053 0.9574
## parent_InfClub 0.085 0.9326
## parent_FarmGr -0.052 0.9582
## parent_WomenClub 0.117 0.9067
## parent_MiscClub 0.063 0.9494
## parent_ClubLev -0.026 0.9790
## parent_FInc -0.005 0.9963
## parent_HHInc -0.048 0.9621
## parent_OwnHome -0.110 0.9128
## parent_Senate 0.296 0.7672
## parent_Tito 0.296 0.7672
## parent_Court 0.296 0.7672
## parent_Govern 0.296 0.7672
## parent_CCamp 0.296 0.7672
## parent_FDR 0.296 0.7672
## parent_Knowledge -0.296 0.7672
## parent_Gen 0.066 0.9475
## parent_Race 0.037 0.9709
## distance 0.229 0.8190
## weights NA NA
## subclass2 1.632 0.1039
## subclass3 1.154 0.2495
## subclass4 1.184 0.2376
## subclass5 1.295 0.1963
## subclass6 1.740 0.0831 .
## subclass7 1.808 0.0717 .
## subclass8 1.725 0.0857 .
## subclass9 1.305 0.1930
## subclass10 1.831 0.0682 .
## subclass11 1.529 0.1275
## subclass12 1.378 0.1695
## subclass13 1.132 0.2585
## subclass14 1.801 0.0728 .
## subclass15 1.506 0.1333
## subclass16 1.488 0.1378
## subclass17 1.144 0.2536
## subclass18 1.489 0.1377
## subclass19 1.390 0.1658
## subclass20 1.528 0.1277
## subclass21 1.378 0.1692
## subclass22 1.289 0.1984
## subclass23 1.654 0.0993 .
## subclass24 1.620 0.1064
## subclass25 1.588 0.1136
## subclass26 1.464 0.1443
## subclass27 1.276 0.2030
## subclass28 1.778 0.0765 .
## subclass29 1.634 0.1035
## subclass30 1.886 0.0604 .
## subclass31 1.592 0.1125
## subclass32 1.799 0.0731 .
## subclass33 1.700 0.0902 .
## subclass34 1.191 0.2346
## subclass35 1.171 0.2428
## subclass36 1.538 0.1252
## subclass37 1.268 0.2059
## subclass38 1.189 0.2354
## subclass39 1.258 0.2093
## subclass40 1.355 0.1764
## subclass41 1.802 0.0726 .
## subclass42 1.242 0.2153
## subclass43 1.783 0.0756 .
## subclass44 1.512 0.1318
## subclass45 1.407 0.1605
## subclass46 1.505 0.1336
## subclass47 1.678 0.0946 .
## subclass48 1.389 0.1659
## subclass49 1.779 0.0763 .
## subclass50 1.445 0.1496
## subclass51 1.852 0.0651 .
## subclass52 1.858 0.0642 .
## subclass53 1.396 0.1640
## subclass54 1.426 0.1551
## subclass55 1.249 0.2127
## subclass56 1.719 0.0867 .
## subclass57 1.643 0.1016
## subclass58 1.729 0.0849 .
## subclass59 1.748 0.0815 .
## subclass60 1.778 0.0765 .
## subclass61 1.130 0.2594
## subclass62 1.276 0.2029
## subclass63 1.250 0.2124
## subclass64 1.307 0.1922
## subclass65 1.511 0.1320
## subclass66 1.652 0.0998 .
## subclass67 1.471 0.1425
## subclass68 1.686 0.0930 .
## subclass69 1.151 0.2509
## subclass70 1.782 0.0759 .
## subclass71 1.561 0.1198
## subclass72 1.317 0.1888
## subclass73 1.377 0.1697
## subclass74 1.831 0.0682 .
## subclass75 1.583 0.1146
## subclass76 1.572 0.1171
## subclass77 1.310 0.1914
## subclass78 1.035 0.3016
## subclass79 1.630 0.1044
## subclass80 1.282 0.2009
## subclass81 1.598 0.1112
## subclass82 1.437 0.1517
## subclass83 1.235 0.2177
## subclass84 1.130 0.2594
## subclass85 1.574 0.1167
## subclass86 1.620 0.1065
## subclass87 1.496 0.1357
## subclass88 1.644 0.1014
## subclass89 1.786 0.0751 .
## subclass90 1.153 0.2499
## subclass91 1.769 0.0779 .
## subclass92 1.955 0.0516 .
## subclass93 1.691 0.0919 .
## subclass94 1.189 0.2354
## subclass95 1.467 0.1436
## subclass96 1.330 0.1846
## subclass97 1.772 0.0776 .
## subclass98 1.130 0.2594
## subclass99 1.882 0.0609 .
## subclass100 1.152 0.2505
## subclass101 1.269 0.2055
## subclass102 1.551 0.1220
## subclass103 1.475 0.1413
## subclass104 1.249 0.2127
## subclass105 1.749 0.0814 .
## subclass106 1.569 0.1178
## subclass107 1.589 0.1131
## subclass108 1.395 0.1641
## subclass109 1.264 0.2071
## subclass110 1.780 0.0763 .
## subclass111 1.548 0.1229
## subclass112 1.728 0.0851 .
## subclass113 1.515 0.1309
## subclass114 1.794 0.0739 .
## subclass115 1.647 0.1008
## subclass116 1.542 0.1243
## subclass117 1.511 0.1321
## subclass118 1.611 0.1084
## subclass119 1.990 0.0476 *
## subclass120 1.863 0.0636 .
## subclass121 1.700 0.0902 .
## subclass122 1.107 0.2691
## subclass123 1.413 0.1588
## subclass124 1.827 0.0688 .
## subclass125 1.351 0.1777
## subclass126 1.448 0.1488
## subclass127 1.166 0.2447
## subclass128 1.371 0.1716
## subclass129 1.930 0.0547 .
## subclass130 1.445 0.1495
## subclass131 1.219 0.2238
## subclass132 1.677 0.0947 .
## subclass133 1.544 0.1237
## subclass134 1.582 0.1148
## subclass135 1.256 0.2102
## subclass136 1.944 0.0529 .
## subclass137 1.779 0.0764 .
## subclass138 1.780 0.0762 .
## subclass139 1.136 0.2571
## subclass140 1.269 0.2057
## subclass141 1.522 0.1291
## subclass142 1.252 0.2115
## subclass143 1.450 0.1483
## subclass144 1.393 0.1647
## subclass145 1.230 0.2199
## subclass146 1.709 0.0886 .
## subclass147 1.658 0.0986 .
## subclass148 1.610 0.1085
## subclass149 1.442 0.1503
## subclass150 1.479 0.1403
## subclass151 1.342 0.1806
## subclass152 1.318 0.1885
## subclass153 1.215 0.2253
## subclass154 1.523 0.1289
## subclass155 1.347 0.1790
## subclass156 1.661 0.0979 .
## subclass157 1.157 0.2485
## subclass158 1.468 0.1431
## subclass159 1.822 0.0695 .
## subclass160 1.287 0.1994
## subclass161 1.231 0.2194
## subclass162 1.469 0.1431
## subclass163 1.315 0.1897
## subclass164 1.147 0.2524
## subclass165 1.174 0.2414
## subclass166 1.375 0.1703
## subclass167 1.919 0.0560 .
## subclass168 1.744 0.0823 .
## subclass169 1.773 0.0774 .
## subclass170 1.246 0.2137
## subclass171 1.341 0.1811
## subclass172 1.347 0.1790
## subclass173 1.767 0.0784 .
## subclass174 1.531 0.1268
## subclass175 1.600 0.1107
## subclass176 1.270 0.2052
## subclass177 1.358 0.1757
## subclass178 1.478 0.1407
## subclass179 1.441 0.1508
## subclass180 1.250 0.2125
## subclass181 1.524 0.1286
## subclass182 1.869 0.0628 .
## subclass183 1.159 0.2474
## subclass184 1.695 0.0912 .
## subclass185 1.404 0.1615
## subclass186 1.446 0.1492
## subclass187 1.662 0.0978 .
## subclass188 1.217 0.2246
## subclass189 1.556 0.1208
## subclass190 1.282 0.2009
## subclass191 1.502 0.1342
## subclass192 1.761 0.0794 .
## subclass193 1.262 0.2080
## subclass194 1.356 0.1763
## subclass195 1.199 0.2317
## subclass196 1.398 0.1633
## subclass197 1.274 0.2038
## subclass198 1.612 0.1081
## subclass199 1.228 0.2204
## subclass200 1.474 0.1416
## subclass201 1.539 0.1249
## subclass202 1.494 0.1363
## subclass203 1.725 0.0856 .
## subclass204 1.518 0.1303
## subclass205 1.344 0.1800
## subclass206 1.306 0.1927
## subclass207 1.614 0.1077
## subclass208 1.356 0.1763
## subclass209 1.657 0.0987 .
## subclass210 1.158 0.2479
## subclass211 1.506 0.1332
## subclass212 1.336 0.1827
## subclass213 1.448 0.1487
## subclass214 1.800 0.0730 .
## subclass215 1.669 0.0962 .
## subclass216 1.922 0.0556 .
## subclass217 1.473 0.1418
## subclass218 1.511 0.1320
## subclass219 1.266 0.2067
## subclass220 1.522 0.1293
## subclass221 1.426 0.1551
## subclass222 1.114 0.2663
## subclass223 1.827 0.0689 .
## subclass224 1.214 0.2256
## subclass225 1.357 0.1759
## subclass226 1.556 0.1210
## subclass227 1.200 0.2314
## subclass228 1.766 0.0785 .
## subclass229 1.424 0.1556
## subclass230 1.138 0.2562
## subclass231 1.703 0.0898 .
## subclass232 1.421 0.1564
## subclass233 1.618 0.1067
## subclass234 1.256 0.2103
## subclass235 1.773 0.0774 .
## subclass236 1.831 0.0682 .
## subclass237 1.584 0.1143
## subclass238 1.813 0.0710 .
## subclass239 1.526 0.1283
## subclass240 1.646 0.1010
## subclass241 1.489 0.1377
## subclass242 1.269 0.2055
## subclass243 1.752 0.0809 .
## subclass244 1.311 0.1910
## subclass245 1.841 0.0667 .
## subclass246 1.423 0.1558
## subclass247 1.593 0.1123
## subclass248 1.566 0.1185
## subclass249 1.744 0.0823 .
## subclass250 1.316 0.1894
## subclass251 1.149 0.2517
## subclass252 1.441 0.1506
## subclass253 1.658 0.0984 .
## subclass254 1.308 0.1921
## subclass255 1.594 0.1120
## subclass256 1.435 0.1524
## subclass257 1.773 0.0773 .
## subclass258 1.553 0.1215
## subclass259 1.423 0.1558
## subclass260 1.683 0.0935 .
## subclass261 1.225 0.2215
## subclass262 1.731 0.0847 .
## subclass263 1.370 0.1719
## subclass264 1.318 0.1885
## subclass265 1.585 0.1141
## subclass266 1.444 0.1500
## subclass267 1.605 0.1096
## subclass268 1.740 0.0830 .
## subclass269 1.613 0.1079
## subclass270 1.528 0.1276
## subclass271 1.742 0.0826 .
## subclass272 1.833 0.0680 .
## subclass273 1.226 0.2213
## subclass274 1.332 0.1840
## subclass275 1.583 0.1146
## subclass276 1.685 0.0932 .
## subclass277 1.303 0.1936
## subclass278 1.634 0.1034
## subclass279 1.155 0.2492
## subclass280 1.527 0.1279
## subclass281 1.245 0.2140
## subclass282 1.653 0.0995 .
## subclass283 1.780 0.0761 .
## subclass284 1.317 0.1889
## subclass285 1.530 0.1272
## subclass286 1.660 0.0980 .
## subclass287 1.811 0.0713 .
## subclass288 1.794 0.0738 .
## subclass289 1.490 0.1374
## subclass290 1.411 0.1593
## subclass291 1.281 0.2014
## subclass292 1.666 0.0969 .
## subclass293 1.780 0.0762 .
## subclass294 1.192 0.2345
## subclass295 1.889 0.0599 .
## subclass296 1.646 0.1010
## subclass297 1.615 0.1075
## subclass298 1.582 0.1147
## subclass299 1.675 0.0951 .
## subclass300 1.497 0.1355
## subclass301 1.691 0.0921 .
## subclass302 1.444 0.1498
## subclass303 1.289 0.1985
## subclass304 1.371 0.1716
## subclass305 1.555 0.1211
## subclass306 1.299 0.1950
## subclass307 1.772 0.0775 .
## subclass308 1.480 0.1400
## subclass309 1.809 0.0715 .
## subclass310 1.327 0.1855
## subclass311 1.811 0.0713 .
## subclass312 1.711 0.0882 .
## subclass313 1.444 0.1499
## subclass314 1.413 0.1589
## subclass315 1.742 0.0827 .
## subclass316 1.565 0.1187
## subclass317 1.618 0.1069
## subclass318 1.695 0.0912 .
## subclass319 1.467 0.1436
## subclass320 1.605 0.1097
## subclass321 1.875 0.0619 .
## subclass322 1.855 0.0646 .
## subclass323 1.153 0.2498
## subclass324 1.665 0.0971 .
## subclass325 1.336 0.1826
## subclass326 1.265 0.2069
## subclass327 1.762 0.0792 .
## subclass328 1.744 0.0823 .
## subclass329 1.910 0.0571 .
## subclass330 1.826 0.0689 .
## subclass331 1.516 0.1306
## subclass332 1.222 0.2226
## subclass333 1.576 0.1162
## subclass334 1.325 0.1865
## subclass335 1.667 0.0967 .
## subclass336 1.679 0.0944 .
## subclass337 1.608 0.1091
## subclass338 1.704 0.0895 .
## subclass339 1.188 0.2360
## subclass340 1.772 0.0775 .
## subclass341 1.726 0.0855 .
## subclass342 1.591 0.1129
## subclass343 1.156 0.2485
## subclass344 1.481 0.1398
## subclass345 1.378 0.1695
## subclass346 1.611 0.1084
## subclass347 1.605 0.1096
## subclass348 1.540 0.1247
## subclass349 1.895 0.0591 .
## subclass350 1.294 0.1967
## subclass351 1.298 0.1953
## subclass352 1.785 0.0753 .
## subclass353 1.894 0.0592 .
## subclass354 1.131 0.2591
## subclass355 1.665 0.0970 .
## subclass356 1.536 0.1258
## subclass357 1.206 0.2289
## subclass358 1.339 0.1816
## subclass359 1.472 0.1421
## subclass360 1.671 0.0958 .
## subclass361 1.783 0.0758 .
## subclass362 1.567 0.1183
## subclass363 1.484 0.1390
## subclass364 1.777 0.0766 .
## subclass365 1.709 0.0885 .
## subclass366 1.302 0.1941
## subclass367 1.540 0.1247
## subclass368 1.417 0.1576
## subclass369 1.334 0.1834
## subclass370 1.511 0.1319
## subclass371 1.763 0.0790 .
## subclass372 1.556 0.1208
## subclass373 1.574 0.1167
## subclass374 1.404 0.1616
## subclass375 1.241 0.2156
## subclass376 1.524 0.1287
## subclass377 1.844 0.0662 .
## subclass378 1.836 0.0675 .
## subclass379 1.655 0.0990 .
## subclass380 1.750 0.0812 .
## subclass381 1.890 0.0598 .
## subclass382 1.872 0.0623 .
## subclass383 1.621 0.1063
## subclass384 1.423 0.1560
## subclass385 1.224 0.2220
## subclass386 1.931 0.0546 .
## subclass387 1.814 0.0708 .
## subclass388 1.409 0.1599
## subclass389 1.486 0.1386
## subclass390 1.818 0.0702 .
## subclass391 1.150 0.2510
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for gaussian family taken to be 0.0000000000000000000000000255111)
##
## Null deviance: 3256.0971867007347100297920405865 on 781 degrees of freedom
## Residual deviance: 0.0000000000000000000000069135 on 271 degrees of freedom
## AIC: -43669
##
## Number of Fisher Scoring iterations: 1
#
# pull out ATT
# ---------
ATT_ps_all <- lm_ps_att_all_summ$coefficients["college", "Estimate"]
ATT_ps_all
## [1] 0.00000000000002122795
# love plot to show standardized mean differences
love.plot(match_ps_att_all, # dataset
abs = TRUE, # absolute standardized mean differences
thresholds = 0.1,# define threshold parameter per prompt
# stats,
stars = "raw")
# balance stats
balance_stats <- bal.tab(match_ps_att_all, abs = TRUE, un = TRUE)
# Count from Balance Table, Diff.Adj column
num_cov_meeting_threshold <- sum(balance_stats$Balance$Diff.Adj <= 0.1, na.rm = TRUE)
print(balance_stats)
## Balance Measures
## Type Diff.Un Diff.Adj
## distance Distance 2.3003 2.7795
## interviewid Contin. 0.1723 0.2290
## student_vote Binary 0.2349 0.2711
## student_meeting Binary 0.2080 0.3606
## student_other Binary 0.1157 0.1841
## student_button Binary 0.1079 0.1867
## student_money Binary 0.1238 0.2020
## student_communicate Binary 0.2485 0.3606
## student_demonstrate Binary 0.1689 0.2916
## student_community Binary 0.1576 0.2148
## student_ppnscal Contin. 0.6977 1.0585
## student_PubAff Binary 0.0026 0.0230
## student_Newspaper Contin. 0.2209 0.2609
## student_Radio Contin. 0.0769 0.0954
## student_TV Contin. 0.0672 0.0861
## student_Magazine Contin. 0.4578 0.5951
## student_FamTalk Contin. 0.2932 0.3666
## student_FrTalk Contin. 0.4468 0.5673
## student_AdultTalk Contin. 0.0350 0.0664
## student_PID Contin. 0.2075 0.3195
## student_SPID Contin. 0.0369 0.0530
## student_GovtOpinion Contin. 0.2193 0.2088
## student_GovtCrook Contin. 0.0593 0.0952
## student_GovtWaste Contin. 0.0472 0.0928
## student_TrGovt Contin. 0.1682 0.1917
## student_GovtSmart Contin. 0.1055 0.0704
## student_Govt4All Contin. 0.0641 0.1513
## student_Cynic Contin. 0.0894 0.0704
## student_LifeWish Contin. 0.1688 0.2348
## student_GLuck Contin. 0.3244 0.3959
## student_FPlans Contin. 0.2966 0.3940
## student_EgoA Contin. 0.3690 0.4668
## student_WinArg Contin. 0.2782 0.4053
## student_StrOpinion Contin. 0.1110 0.1851
## student_MChange Contin. 0.0494 0.1406
## student_EgoB Contin. 0.1676 0.2277
## student_TrOthers Contin. 0.1929 0.2260
## student_OthHelp Contin. 0.0122 0.0163
## student_OthFair Contin. 0.1517 0.1666
## student_Trust Contin. 0.1584 0.1756
## student_Senate Binary 0.2550 0.3555
## student_Tito Binary 0.2402 0.3478
## student_Court Binary 0.2181 0.3402
## student_Govern Binary 0.1151 0.1432
## student_CCamp Binary 0.2049 0.2072
## student_FDR Binary 0.2372 0.3299
## student_Knowledge Contin. 0.9300 1.2617
## student_NextSch Binary 0.3124 0.2685
## student_GPA Contin. 0.5332 0.6837
## student_SchOfficer Contin. 0.2956 0.3457
## student_SchPublish Contin. 0.0883 0.1292
## student_Hobby Contin. 0.0143 0.0058
## student_SchClub Contin. 0.3182 0.4863
## student_OccClub Contin. 0.1678 0.2717
## student_NeighClub Contin. 0.1483 0.1798
## student_RelClub Contin. 0.1403 0.0764
## student_YouthOrg Contin. 0.2155 0.2376
## student_MiscClub Binary 0.1472 0.1944
## student_ClubLev Contin. 0.2775 0.3373
## student_Phone Binary 0.0811 0.0895
## student_Gen Binary 0.1156 0.1458
## student_Race Contin. 0.0359 0.0671
## parent_Newspaper Contin. 0.4612 0.5675
## parent_Radio Contin. 0.0963 0.0711
## parent_TV Contin. 0.0417 0.0923
## parent_Magazine Binary 0.1922 0.2302
## parent_LifeWish Contin. 0.0915 0.0651
## parent_GLuck Contin. 0.4011 0.4215
## parent_FPlans Contin. 0.3554 0.3690
## parent_WinArg Contin. 0.0612 0.0603
## parent_StrOpinion Contin. 0.0050 0.0390
## parent_MChange Contin. 0.0645 0.0520
## parent_TrOthers Contin. 0.4019 0.4765
## parent_OthHelp Contin. 0.1888 0.1605
## parent_OthFair Contin. 0.2325 0.2700
## parent_PID Contin. 0.1579 0.2587
## parent_SPID Contin. 0.0930 0.1271
## parent_Vote Binary 0.1350 0.1586
## parent_Persuade Binary 0.1944 0.2813
## parent_Rally Binary 0.1589 0.2558
## parent_OthAct Binary 0.0808 0.1125
## parent_PolClub Binary 0.0460 0.0614
## parent_Button Binary 0.0860 0.1176
## parent_Money Binary 0.1857 0.3069
## parent_Participate1 Contin. 0.4343 0.6559
## parent_Participate2 Contin. 0.3839 0.5883
## parent_ActFrq Contin. 0.3173 0.4763
## parent_GovtOpinion Contin. 0.2389 0.3004
## parent_GovtCrook Contin. 0.1283 0.1963
## parent_GovtWaste Contin. 0.2498 0.3565
## parent_TrGovt Contin. 0.0804 0.0775
## parent_GovtSmart Contin. 0.0559 0.1140
## parent_Govt4All Contin. 0.0111 0.0688
## parent_Employ Binary 0.0842 0.1202
## parent_EducHH Contin. 0.7880 1.1479
## parent_EducW Contin. 0.6663 0.9430
## parent_ChurchOrg Contin. 0.2870 0.2974
## parent_FratOrg Contin. 0.1756 0.2068
## parent_ProOrg Contin. 0.3986 0.7113
## parent_CivicOrg Contin. 0.2114 0.3306
## parent_CLOrg Contin. 0.1335 0.1525
## parent_NeighClub Contin. 0.1676 0.1860
## parent_SportClub Contin. 0.1486 0.1753
## parent_InfClub Contin. 0.2309 0.3004
## parent_FarmGr Contin. 0.2157 0.3676
## parent_WomenClub Contin. 0.1890 0.2414
## parent_MiscClub Binary 0.0305 0.0486
## parent_ClubLev Contin. 0.1054 0.1517
## parent_FInc Contin. 0.6299 0.8738
## parent_HHInc Contin. 0.6445 0.8709
## parent_OwnHome Binary 0.1015 0.0946
## parent_Senate Binary 0.2059 0.2992
## parent_Tito Binary 0.2616 0.3657
## parent_Court Binary 0.1268 0.1995
## parent_Govern Binary 0.0716 0.0639
## parent_CCamp Binary 0.1430 0.1969
## parent_FDR Binary 0.0350 0.0537
## parent_Knowledge Contin. 0.6426 0.8978
## parent_Gen Binary 0.0590 0.0870
## parent_Race Contin. 0.1197 0.1376
##
## Sample sizes
## Control Treated
## All 451 803
## Matched 391 391
## Unmatched 0 412
## Discarded 60 0
length(balance_stats$Balance$Diff.Adj)
## [1] 120
Henderson/Chatfield argue that an improperly specified propensity score model can actually increase the bias of the estimate. To demonstrate this, they simulate 800,000 different propensity score models by choosing different permutations of covariates.
To investigate their claim, do the following: • Using as many simulations as is feasible (at least 10,000 should be ok, but more is better!), randomly select the number of and the choice of covariates for the propensity score model.
set.seed(123)
### Select Covariates Function
# Function to randomly select covariates and return a subset dataframe
select_cov_ps <- function(data, treatment_var, outcome_var) {
# Get all column names excluding the treatment and outcome variable
covariate_names <- setdiff(names(data), c(treatment_var, outcome_var))
# Randomly decide how many covariates to include (at least 1)
num_covs <- sample(1:length(covariate_names), 1)
# Randomly select 'num_covs' covariates
selected_covs <- sample(covariate_names, num_covs)
# Add back in the treatment and control variables
selected_covs <- c(treatment_var, outcome_var, selected_covs)
# Return dataframe with the selected covariates including the treatment and control variable
return(data[, selected_covs])
}
###### TEST
# test
test_df <- select_cov_ps(df_pretreat, "college", "student_ppnscal")
test_df
## # A tibble: 1,254 × 33
## college student_ppnscal parent_OthAct student_SchClub student_Magazine
## <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 1 3 0 4 1
## 2 1 7 0 3 1
## 3 1 2 0 1 1
## 4 0 2 1 1 1
## 5 1 3 1 1 1
## 6 1 2 0 1 3
## 7 1 3 0 1 1
## 8 1 1 0 4 1
## 9 0 1 0 4 1
## 10 0 3 0 2 1
## # ℹ 1,244 more rows
## # ℹ 28 more variables: parent_FPlans <dbl>, student_Govern <dbl>,
## # student_Hobby <dbl>, student_CCamp <dbl>, parent_SportClub <dbl>,
## # parent_Knowledge <dbl>, student_Govt4All <dbl>, parent_GovtSmart <dbl>,
## # parent_Govt4All <dbl>, parent_StrOpinion <dbl>, parent_FInc <dbl>,
## # student_ClubLev <dbl>, parent_Employ <dbl>, student_community <dbl>,
## # parent_EducHH <dbl>, parent_CLOrg <dbl>, parent_OthHelp <dbl>, …
### Run MatchIt Function I
ps_model <- function(rand_cov_df, treatment_var, outcome_var) {
# List all covariates except 'college' and the outcome variable 'student_ppnscal'
covariate_names <- setdiff(names(rand_cov_df), c("college", "student_ppnscal"))
# Construct the formula manually
formula_str <- paste("college ~", paste(covariate_names, collapse = " + "))
match_formula <- as.formula(formula_str)
# Run MatchIt with the constructed formula
match_ps_att_samp <- matchit(formula = match_formula,
data = rand_cov_df,
method = "nearest",
estimand = "ATT",
distance = "glm",
link = "logit",
discard = "control",
replace = FALSE,
ratio = 2)
# return
return(match_ps_att_samp)
}
##### Construct MatchIt dataset and grab ATT
create_matchit_ds <- function(matchit_obj) {
# construct a matched dataset from the matchit object
match_ps_att_samp_data <- match.data(matchit_obj)
# specify linear model
lm_ps_att_all <- glm(student_ppnscal ~ ., # formula
data = match_ps_att_samp_data, # data
weights = weights) # weights
# view summary results
lm_ps_att_all_summ <- summary(lm_ps_att_all)
print(lm_ps_att_all_summ)
# pull out ATT
ATT_ps_all <- lm_ps_att_all_summ$coefficients["college", "Estimate"]
return(list(ATT_ps_all = ATT_ps_all,
match_ps_att_samp_data = match_ps_att_samp_data))
}
# TEST
test_match_ps_att_samp <- ps_model(test_df, treatment_var, outcome_var)
test_match_results <- create_matchit_ds(test_match_ps_att_samp)
##
## Call:
## glm(formula = student_ppnscal ~ ., data = match_ps_att_samp_data,
## weights = weights)
##
## Coefficients: (1 not defined because of singularities)
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -0.0610594 2.2919736 -0.027 0.97876
## college 0.2141700 0.9794150 0.219 0.82702
## parent_OthAct -0.5650373 0.4207079 -1.343 0.18001
## student_SchClub 0.1980807 0.1387575 1.428 0.15421
## student_Magazine -0.3462968 0.1619258 -2.139 0.03307 *
## parent_FPlans 0.2991908 0.0949111 3.152 0.00174 **
## student_Govern 0.6811273 0.4341358 1.569 0.11746
## student_Hobby -0.0227962 0.1017204 -0.224 0.82279
## student_CCamp 0.6972904 0.5273001 1.322 0.18680
## parent_SportClub -0.0263850 0.0914888 -0.288 0.77319
## parent_Knowledge 1.0495527 1.1810434 0.889 0.37472
## student_Govt4All -0.1478966 0.1107985 -1.335 0.18269
## parent_GovtSmart 0.1550301 0.1073472 1.444 0.14947
## parent_Govt4All 0.1050475 0.0841445 1.248 0.21261
## parent_StrOpinion 0.1204260 0.0843202 1.428 0.15402
## parent_FInc -0.0034584 0.0653152 -0.053 0.95780
## student_ClubLev 0.1251099 0.0795776 1.572 0.11670
## parent_Employ 0.0800562 0.1675497 0.478 0.63305
## student_community 1.7535566 0.3489085 5.026 0.000000758 ***
## parent_EducHH 0.3772427 0.2412514 1.564 0.11868
## parent_CLOrg 0.1895876 0.2803323 0.676 0.49924
## parent_OthHelp 0.0323690 0.0751774 0.431 0.66702
## student_Cynic -0.2132366 0.0935635 -2.279 0.02319 *
## student_communicate 2.4405363 0.4818247 5.065 0.000000625 ***
## parent_CCamp -0.2384917 0.3537129 -0.674 0.50054
## parent_InfClub 0.0264863 0.0712667 0.372 0.71035
## parent_Participate1 0.8281908 0.9713599 0.853 0.39439
## student_OthHelp -0.1951979 0.0703290 -2.775 0.00577 **
## parent_Rally -0.1910612 0.2387578 -0.800 0.42405
## parent_Button 0.2606189 0.2246756 1.160 0.24675
## parent_Court -0.2054953 0.3783780 -0.543 0.58737
## parent_Vote 0.4012859 0.2582528 1.554 0.12101
## student_FamTalk -0.0238551 0.0765792 -0.312 0.75558
## distance -3.3289406 1.3494053 -2.467 0.01405 *
## weights NA NA NA NA
## subclass2 1.3323989 1.4860858 0.897 0.37048
## subclass3 -2.0166234 1.3224235 -1.525 0.12806
## subclass4 -1.9766395 1.3754225 -1.437 0.15147
## subclass5 -0.7484061 1.3059375 -0.573 0.56691
## subclass6 -0.7263074 1.3443726 -0.540 0.58932
## subclass7 -2.0251566 1.3027986 -1.554 0.12087
## subclass8 -0.6501695 1.2932777 -0.503 0.61543
## subclass9 -0.0620016 1.5707560 -0.039 0.96853
## subclass10 0.0733859 1.3813326 0.053 0.95766
## subclass11 -1.0046914 1.3331620 -0.754 0.45152
## subclass12 -1.2992024 1.5167922 -0.857 0.39221
## subclass13 -1.1041503 1.4226349 -0.776 0.43813
## subclass14 -1.3991830 1.3764152 -1.017 0.30999
## subclass15 0.6304748 1.5115463 0.417 0.67683
## subclass16 -1.1256688 1.5818608 -0.712 0.47712
## subclass17 0.9984200 1.3787228 0.724 0.46939
## subclass18 1.3906688 1.3657182 1.018 0.30917
## subclass19 -0.3827457 1.3441667 -0.285 0.77599
## subclass20 -0.1903770 1.3772897 -0.138 0.89013
## subclass21 -0.4399772 1.4028690 -0.314 0.75397
## subclass22 -1.1499337 1.3545167 -0.849 0.39641
## subclass23 1.1927921 1.3243282 0.901 0.36830
## subclass24 -2.1663071 1.3296479 -1.629 0.10405
## subclass25 -1.1783381 1.2966220 -0.909 0.36402
## subclass26 -0.4980664 1.2975799 -0.384 0.70130
## subclass27 0.4607689 1.4077897 0.327 0.74361
## subclass28 1.1450555 1.3037558 0.878 0.38032
## subclass29 0.9691304 1.2965667 0.747 0.45523
## subclass30 0.2118380 1.4257521 0.149 0.88196
## subclass31 -0.0165505 1.4296977 -0.012 0.99077
## subclass32 -1.7490211 1.3765627 -1.271 0.20462
## subclass33 -0.8454829 1.3606886 -0.621 0.53471
## subclass34 -0.4181724 1.4623056 -0.286 0.77505
## subclass35 0.7686789 1.3406798 0.573 0.56673
## subclass36 -0.5174761 1.3271590 -0.390 0.69681
## subclass37 0.2005728 1.3480926 0.149 0.88180
## subclass38 -0.2967502 1.3193026 -0.225 0.82215
## subclass39 -1.0000485 1.3111553 -0.763 0.44608
## subclass40 -0.5033119 1.4737509 -0.342 0.73289
## subclass41 0.1845583 1.3610547 0.136 0.89221
## subclass42 -1.8356543 1.3338940 -1.376 0.16954
## subclass43 -0.1806195 1.3952338 -0.129 0.89706
## subclass44 -1.3496908 1.3285044 -1.016 0.31027
## subclass45 1.0614892 1.3391094 0.793 0.42843
## subclass46 -0.7239065 1.3389236 -0.541 0.58904
## subclass47 -0.8456122 1.3413490 -0.630 0.52878
## subclass48 0.2068820 1.3111229 0.158 0.87470
## subclass49 -0.1995378 1.4138598 -0.141 0.88784
## subclass50 -0.6808678 1.5062648 -0.452 0.65150
## subclass51 -1.3177994 1.3854292 -0.951 0.34209
## subclass52 -1.2348734 1.4297577 -0.864 0.38827
## subclass53 -1.3456525 1.3891636 -0.969 0.33329
## subclass54 -0.4911718 1.3815438 -0.356 0.72239
## subclass55 1.2368440 1.3060734 0.947 0.34421
## subclass56 0.8907860 1.4868620 0.599 0.54944
## subclass57 -1.6505197 1.3228031 -1.248 0.21286
## subclass58 -0.0909127 1.3229191 -0.069 0.94525
## subclass59 -1.4095322 1.2917967 -1.091 0.27587
## subclass60 -1.3780716 1.3425785 -1.026 0.30531
## subclass61 -0.7144978 1.3472038 -0.530 0.59616
## subclass62 -0.6089663 1.3633420 -0.447 0.65535
## subclass63 -1.2131575 1.5207176 -0.798 0.42549
## subclass64 0.3409115 1.4829210 0.230 0.81829
## subclass65 -2.1752285 1.3371604 -1.627 0.10458
## subclass66 1.0113841 1.3619787 0.743 0.45817
## subclass67 -0.4161032 1.3616748 -0.306 0.76008
## subclass68 0.1608377 1.3164639 0.122 0.90282
## subclass69 -0.4501026 1.3936144 -0.323 0.74688
## subclass70 -0.5187894 1.3345681 -0.389 0.69768
## subclass71 -0.8348586 1.3720221 -0.608 0.54321
## subclass72 -0.7899134 1.3771629 -0.574 0.56658
## subclass73 0.1609026 1.4153421 0.114 0.90955
## subclass74 0.0719482 1.3076869 0.055 0.95615
## subclass75 0.6072874 1.3202844 0.460 0.64579
## subclass76 -0.2249130 1.5780097 -0.143 0.88673
## subclass77 1.5765798 1.3613356 1.158 0.24751
## subclass78 -0.2196573 1.5217449 -0.144 0.88530
## subclass79 0.4301491 1.3600236 0.316 0.75195
## subclass80 -1.1585601 1.4301168 -0.810 0.41836
## subclass81 -1.3038359 1.4105747 -0.924 0.35587
## subclass82 1.4935410 1.4894509 1.003 0.31659
## subclass83 0.7982794 1.3483876 0.592 0.55417
## subclass84 0.3887588 1.3448662 0.289 0.77268
## subclass85 -0.1221155 1.3577603 -0.090 0.92838
## subclass86 0.4804060 1.4327450 0.335 0.73757
## subclass87 -1.7979019 1.3368080 -1.345 0.17941
## subclass88 -0.4159744 1.3824939 -0.301 0.76366
## subclass89 0.6623045 1.3194732 0.502 0.61598
## subclass90 0.0968914 1.2908874 0.075 0.94021
## subclass91 -1.7507114 1.3365474 -1.310 0.19099
## subclass92 -0.8312751 1.3499432 -0.616 0.53839
## subclass93 0.4305016 1.3215868 0.326 0.74479
## subclass94 0.1932625 1.2985409 0.149 0.88176
## subclass95 0.3544234 1.3202140 0.268 0.78848
## subclass96 0.0498751 1.3239141 0.038 0.96997
## subclass97 0.3245907 1.4327328 0.227 0.82089
## subclass98 -0.4987020 1.4008292 -0.356 0.72203
## subclass99 -2.6273815 1.3195931 -1.991 0.04716 *
## subclass100 0.4221356 1.3410745 0.315 0.75310
## subclass101 -1.4406075 1.3904804 -1.036 0.30081
## subclass102 0.0508019 1.3860122 0.037 0.97078
## subclass103 0.0988662 1.4088732 0.070 0.94409
## subclass104 3.0577642 1.5488124 1.974 0.04904 *
## subclass105 0.1837179 1.2920006 0.142 0.88700
## subclass106 -0.5274849 1.3462091 -0.392 0.69539
## subclass107 0.2141993 1.2948201 0.165 0.86869
## subclass108 -1.2729565 1.3697243 -0.929 0.35327
## subclass109 -0.7252705 1.4741133 -0.492 0.62299
## subclass110 -0.7059871 1.3027001 -0.542 0.58816
## subclass111 0.3743106 1.3288747 0.282 0.77834
## subclass112 0.7040870 1.4462847 0.487 0.62665
## subclass113 -1.0263756 1.4977672 -0.685 0.49357
## subclass114 -1.0831917 1.3367548 -0.810 0.41824
## subclass115 -0.3543201 1.3039372 -0.272 0.78597
## subclass116 -1.3137708 1.3600657 -0.966 0.33465
## subclass117 -0.6166750 1.4464319 -0.426 0.67009
## subclass118 -0.7758200 1.3399965 -0.579 0.56293
## subclass119 -0.0036094 1.2965385 -0.003 0.99778
## subclass120 0.6623793 1.3589198 0.487 0.62622
## subclass121 2.0045249 1.4130181 1.419 0.15679
## subclass122 1.5824850 1.2991927 1.218 0.22392
## subclass123 -0.4369803 1.3095700 -0.334 0.73879
## subclass124 0.2269899 1.4550298 0.156 0.87611
## subclass125 -0.0199312 1.5919137 -0.013 0.99002
## subclass126 0.6011278 1.3054366 0.460 0.64542
## subclass127 -0.3374194 1.3063882 -0.258 0.79632
## subclass128 -1.3025239 1.5008975 -0.868 0.38601
## subclass129 -0.5938983 1.3769632 -0.431 0.66648
## subclass130 -0.8367240 1.3376668 -0.626 0.53199
## subclass131 -0.6261980 1.3261085 -0.472 0.63704
## subclass132 0.0268424 1.3415254 0.020 0.98405
## subclass133 -0.3679801 1.3421224 -0.274 0.78409
## subclass134 -0.1787178 1.2980904 -0.138 0.89056
## subclass135 -0.6650445 1.2991312 -0.512 0.60899
## subclass136 -0.2901301 1.3122421 -0.221 0.82513
## subclass137 -0.8264052 1.3284233 -0.622 0.53423
## subclass138 -0.3426546 1.3754019 -0.249 0.80339
## subclass139 1.6697452 1.3402460 1.246 0.21355
## subclass140 -1.5869647 1.3850038 -1.146 0.25256
## subclass141 -1.8410195 1.4358874 -1.282 0.20054
## subclass142 -1.5907610 1.3635277 -1.167 0.24405
## subclass143 -1.4549391 1.4222566 -1.023 0.30694
## subclass144 0.1463305 1.3938358 0.105 0.91644
## subclass145 -0.6801947 1.4291349 -0.476 0.63437
## subclass146 -0.7968540 1.3217501 -0.603 0.54693
## subclass147 -0.4364934 1.3018061 -0.335 0.73758
## subclass148 -0.2733067 1.3914422 -0.196 0.84438
## subclass149 0.8516818 1.5381946 0.554 0.58010
## subclass150 0.5661133 1.3096658 0.432 0.66579
## subclass151 -0.5589467 1.4702104 -0.380 0.70401
## subclass152 -0.5112790 1.3217426 -0.387 0.69909
## subclass153 1.4673951 1.5631784 0.939 0.34844
## subclass154 0.4451018 1.3158776 0.338 0.73535
## subclass155 -3.1708018 1.3064482 -2.427 0.01566 *
## subclass156 -1.2683847 1.4979974 -0.847 0.39766
## subclass157 -0.8506395 1.3417416 -0.634 0.52646
## subclass158 0.0647814 1.3596565 0.048 0.96202
## subclass159 -1.3623529 1.3113771 -1.039 0.29949
## subclass160 0.6188146 1.3086599 0.473 0.63657
## subclass161 -0.3178592 1.4118334 -0.225 0.82199
## subclass162 1.2561750 1.3935838 0.901 0.36792
## subclass163 0.6569021 1.4453376 0.454 0.64972
## subclass164 0.4519355 1.2923480 0.350 0.72675
## subclass165 -0.6849229 1.4640017 -0.468 0.64015
## subclass166 -0.0409218 1.4585265 -0.028 0.97763
## subclass167 3.5365654 1.4047244 2.518 0.01221 *
## subclass168 -0.3670089 1.3506865 -0.272 0.78598
## subclass169 -0.5025541 1.3030746 -0.386 0.69995
## subclass170 -0.7089181 1.3827219 -0.513 0.60845
## subclass171 1.1943312 1.2957385 0.922 0.35722
## subclass172 0.7010109 1.3995712 0.501 0.61673
## subclass173 -2.0340362 1.3910910 -1.462 0.14448
## subclass174 -0.6190450 1.4592044 -0.424 0.67162
## subclass175 -0.3125876 1.3705749 -0.228 0.81971
## subclass176 0.3823001 1.3491595 0.283 0.77705
## subclass177 0.4542647 1.4270468 0.318 0.75040
## subclass178 0.1993224 1.3449389 0.148 0.88226
## subclass179 -0.7796175 1.6217596 -0.481 0.63098
## subclass180 -1.6181460 1.4983866 -1.080 0.28083
## subclass181 -1.2037756 1.4644674 -0.822 0.41157
## subclass182 -0.1271441 1.5615844 -0.081 0.93515
## subclass183 0.4951227 1.5160460 0.327 0.74415
## subclass184 -1.1419920 1.2963692 -0.881 0.37889
## subclass185 0.5934813 1.3371369 0.444 0.65740
## subclass186 0.0523854 1.3978497 0.037 0.97012
## subclass187 0.2795442 1.3153108 0.213 0.83180
## subclass188 -0.5035345 1.5298993 -0.329 0.74223
## subclass189 -1.1792709 1.4450023 -0.816 0.41493
## subclass190 0.7105026 1.3084486 0.543 0.58743
## subclass191 -0.5350088 1.4238369 -0.376 0.70730
## subclass192 -0.7492754 1.3342200 -0.562 0.57472
## subclass193 -0.0091390 1.3070377 -0.007 0.99442
## subclass194 -0.9514394 1.3367417 -0.712 0.47703
## subclass195 -0.8524350 1.3335472 -0.639 0.52304
## subclass196 -0.5609841 1.4169881 -0.396 0.69239
## subclass197 -0.9204285 1.3863840 -0.664 0.50713
## subclass198 -0.9333231 1.3935691 -0.670 0.50341
## subclass199 -1.1699839 1.3126699 -0.891 0.37330
## subclass200 0.6375934 1.3354335 0.477 0.63331
## subclass201 0.1854679 1.3153877 0.141 0.88794
## subclass202 0.9110018 1.3428566 0.678 0.49791
## subclass203 -1.6362795 1.2951770 -1.263 0.20720
## subclass204 -0.4934087 1.4631635 -0.337 0.73613
## subclass205 0.6032230 1.4901169 0.405 0.68583
## subclass206 -0.6864095 1.5294746 -0.449 0.65383
## subclass207 -1.3319602 1.3026313 -1.023 0.30716
## subclass208 -0.6455701 1.3244053 -0.487 0.62621
## subclass209 0.2607413 1.4491025 0.180 0.85730
## subclass210 -1.2288195 1.3252014 -0.927 0.35435
## subclass211 -1.4019249 1.4460959 -0.969 0.33291
## subclass212 -0.5754273 1.3713310 -0.420 0.67499
## subclass213 -1.6096214 1.3728514 -1.172 0.24171
## subclass214 0.1429785 1.3323137 0.107 0.91459
## subclass215 -1.8350499 1.4318029 -1.282 0.20071
## subclass216 -0.1662882 1.3146478 -0.126 0.89941
## subclass217 0.8001737 1.4438994 0.554 0.57977
## subclass218 -0.4949512 1.2976121 -0.381 0.70309
## subclass219 -2.1044051 1.7735069 -1.187 0.23610
## subclass220 -1.0127879 1.5279015 -0.663 0.50780
## subclass221 1.0019502 1.4558278 0.688 0.49171
## subclass222 0.2665182 1.3962433 0.191 0.84871
## subclass223 -0.7401466 1.3095494 -0.565 0.57226
## subclass224 0.0787432 1.2989695 0.061 0.95169
## subclass225 1.5412372 1.3554094 1.137 0.25618
## subclass226 -0.7054218 1.3990932 -0.504 0.61440
## subclass227 -1.5168063 1.3121611 -1.156 0.24839
## subclass228 -1.2095958 1.3492954 -0.896 0.37055
## subclass229 -1.0713927 1.4037681 -0.763 0.44578
## subclass230 -0.5292671 1.4613483 -0.362 0.71741
## subclass231 0.0629675 1.5354884 0.041 0.96731
## subclass232 -0.1114710 1.3087240 -0.085 0.93216
## subclass233 0.0187569 1.5558173 0.012 0.99039
## subclass234 -0.5971116 1.3650694 -0.437 0.66204
## subclass235 -1.3194297 1.3341614 -0.989 0.32328
## subclass236 -0.0334813 1.4310114 -0.023 0.98135
## subclass237 -0.7193315 1.3876512 -0.518 0.60448
## subclass238 -0.2496589 1.3626066 -0.183 0.85472
## subclass239 -1.0397405 1.3619924 -0.763 0.44568
## subclass240 0.8864736 1.2934354 0.685 0.49351
## subclass241 0.5918969 1.3543220 0.437 0.66232
## subclass242 -1.4167904 1.3533783 -1.047 0.29580
## subclass243 -1.8356362 1.3001767 -1.412 0.15878
## subclass244 -0.5273589 1.4616801 -0.361 0.71845
## subclass245 1.2646988 1.3958307 0.906 0.36545
## subclass246 -1.8184989 1.3687288 -1.329 0.18474
## subclass247 -1.3072519 1.4214105 -0.920 0.35829
## subclass248 -1.3368425 1.2991629 -1.029 0.30410
## subclass249 -1.2912066 1.3280605 -0.972 0.33152
## subclass250 1.6167839 1.5111142 1.070 0.28530
## subclass251 -1.3192455 1.3131995 -1.005 0.31570
## subclass252 0.1207168 1.4484274 0.083 0.93362
## subclass253 -0.4148781 1.3538548 -0.306 0.75943
## subclass254 1.3074986 1.3621438 0.960 0.33770
## subclass255 -0.8342623 1.3020739 -0.641 0.52207
## subclass256 0.2499063 1.2931042 0.193 0.84685
## subclass257 -0.2967616 1.4353186 -0.207 0.83631
## subclass258 1.8596095 1.3437554 1.384 0.16717
## subclass259 -1.0520874 1.4660058 -0.718 0.47339
## subclass260 0.8304647 1.3127921 0.633 0.52736
## subclass261 -0.2355542 1.3666343 -0.172 0.86324
## subclass262 0.8776191 1.3287104 0.661 0.50931
## subclass263 -0.0838937 1.3333283 -0.063 0.94986
## subclass264 2.4811308 1.3287817 1.867 0.06260 .
## subclass265 -1.3653560 1.2981833 -1.052 0.29355
## subclass266 -0.6766231 1.3739638 -0.492 0.62266
## subclass267 0.4464494 1.3248163 0.337 0.73630
## subclass268 -2.5119573 1.3030100 -1.928 0.05459 .
## subclass269 -0.7020001 1.3791175 -0.509 0.61102
## subclass270 0.9540977 1.3883737 0.687 0.49235
## subclass271 -1.4574063 1.2985193 -1.122 0.26238
## subclass272 -1.5163987 1.4297869 -1.061 0.28952
## subclass273 0.0438607 1.4760190 0.030 0.97631
## subclass274 -1.3031784 1.3482519 -0.967 0.33435
## subclass275 -0.7296624 1.3573883 -0.538 0.59119
## subclass276 2.8750688 1.4261383 2.016 0.04447 *
## subclass277 -0.7254291 1.3528468 -0.536 0.59210
## subclass278 0.4239107 1.3797511 0.307 0.75882
## subclass279 -1.8582721 1.3062705 -1.423 0.15564
## subclass280 -1.0562583 1.5226157 -0.694 0.48827
## subclass281 -1.9699790 1.3464240 -1.463 0.14422
## subclass282 -1.4265002 1.3637125 -1.046 0.29618
## subclass283 0.4255616 1.3340146 0.319 0.74989
## subclass284 -1.0640043 1.3079583 -0.813 0.41643
## subclass285 -3.0722915 1.4804854 -2.075 0.03861 *
## subclass286 -1.3788914 1.3219498 -1.043 0.29755
## subclass287 0.8145612 1.3190350 0.618 0.53723
## subclass288 0.3277543 1.5318811 0.214 0.83069
## subclass289 -0.2589566 1.3409106 -0.193 0.84696
## subclass290 -0.0006149 1.5709071 0.000 0.99969
## subclass291 -0.8346659 1.5414003 -0.541 0.58847
## subclass292 2.0843313 1.3260404 1.572 0.11678
## subclass293 0.2110902 1.3554291 0.156 0.87632
## subclass294 -2.9736304 1.5609128 -1.905 0.05749 .
## subclass295 -1.4098497 1.5248492 -0.925 0.35574
## subclass296 0.3488595 1.4122062 0.247 0.80501
## subclass297 1.0120739 1.3836248 0.731 0.46492
## subclass298 2.8905068 1.4788713 1.955 0.05134 .
## subclass299 -0.3451393 1.3611512 -0.254 0.79996
## subclass300 -2.4470315 1.3473384 -1.816 0.07009 .
## subclass301 -0.2535755 1.3039265 -0.194 0.84591
## subclass302 -2.2678247 1.6663413 -1.361 0.17429
## subclass303 -1.2393400 1.3543824 -0.915 0.36071
## subclass304 1.2259202 1.4194640 0.864 0.38830
## subclass305 0.8582509 1.3237116 0.648 0.51712
## subclass306 0.2859424 1.5555225 0.184 0.85424
## subclass307 -0.3547417 1.3176056 -0.269 0.78789
## subclass308 -0.2347709 1.4545070 -0.161 0.87185
## subclass309 -1.2671930 1.5739566 -0.805 0.42124
## subclass310 -0.8207710 1.3111034 -0.626 0.53166
## subclass311 0.4417654 1.3098859 0.337 0.73610
## subclass312 -1.0543065 1.4233880 -0.741 0.45931
## subclass313 -1.7184864 1.3417006 -1.281 0.20100
## subclass314 -0.1472796 1.4294794 -0.103 0.91799
## subclass315 -0.7719654 1.4563071 -0.530 0.59635
## subclass316 1.0489224 1.3800310 0.760 0.44766
## subclass317 1.7515423 1.3578041 1.290 0.19780
## subclass318 0.5219653 1.4369931 0.363 0.71662
## subclass319 -2.1628096 1.3918182 -1.554 0.12099
## subclass320 -0.3363262 1.3044045 -0.258 0.79666
## subclass321 -0.1402129 1.4282635 -0.098 0.92185
## subclass322 -1.1403302 1.5582879 -0.732 0.46473
## subclass323 -0.1387847 1.2985931 -0.107 0.91494
## subclass324 -1.8178144 1.3948084 -1.303 0.19323
## subclass325 -0.3884986 1.3414209 -0.290 0.77226
## subclass326 -0.9305443 1.4932803 -0.623 0.53354
## subclass327 -0.7647471 1.3364981 -0.572 0.56751
## subclass328 -0.0054793 1.3393867 -0.004 0.99674
## subclass329 -0.1408911 1.3219988 -0.107 0.91518
## subclass330 0.9027960 1.3954414 0.647 0.51803
## subclass331 -2.2985701 1.6212929 -1.418 0.15705
## subclass332 -0.3691369 1.4804965 -0.249 0.80323
## subclass333 1.3368116 1.3229067 1.011 0.31286
## subclass334 0.0702615 1.3143380 0.053 0.95739
## subclass335 -0.3440583 1.3497302 -0.255 0.79892
## subclass336 -0.3588172 1.4124242 -0.254 0.79959
## subclass337 -1.5987462 1.3653450 -1.171 0.24232
## subclass338 -0.6739845 1.4706128 -0.458 0.64699
## subclass339 0.6574578 1.3875637 0.474 0.63589
## subclass340 -1.5388992 1.4490532 -1.062 0.28888
## subclass341 -0.5305804 1.3028470 -0.407 0.68405
## subclass342 -1.8249896 1.3156215 -1.387 0.16616
## subclass343 -1.2589576 1.3762273 -0.915 0.36085
## subclass344 -0.0104363 1.3703559 -0.008 0.99393
## subclass345 -0.6559022 1.4002017 -0.468 0.63973
## subclass346 0.2944254 1.3898943 0.212 0.83235
## subclass347 -1.3447426 1.2959465 -1.038 0.30006
## subclass348 1.3714033 1.3052723 1.051 0.29405
## subclass349 0.4522594 1.5227673 0.297 0.76662
## subclass350 2.3743205 1.4638272 1.622 0.10559
## subclass351 0.6623034 1.3676138 0.484 0.62846
## subclass352 -0.7554569 1.3074446 -0.578 0.56372
## subclass353 -0.1042783 1.3005451 -0.080 0.93613
## subclass354 0.3483264 1.3190543 0.264 0.79186
## subclass355 -0.2680194 1.3044992 -0.205 0.83732
## subclass356 -1.6054097 1.4995570 -1.071 0.28500
## subclass357 0.8534661 1.3353757 0.639 0.52311
## subclass358 2.0520376 1.3049803 1.572 0.11664
## subclass359 -0.8256472 1.5755276 -0.524 0.60054
## subclass360 -1.8636496 1.3037967 -1.429 0.15367
## subclass361 0.7441578 1.3532039 0.550 0.58268
## subclass362 0.6738132 1.2873300 0.523 0.60097
## subclass363 -1.8314088 1.3821976 -1.325 0.18593
## subclass364 -0.5281067 1.3791321 -0.383 0.70198
## subclass365 -0.1069198 1.3401005 -0.080 0.93645
## subclass366 -1.9675262 1.3642207 -1.442 0.15002
## subclass367 0.5582127 1.4999395 0.372 0.70997
## subclass368 0.0233205 1.3360788 0.017 0.98608
## subclass369 -1.1489137 1.3519144 -0.850 0.39592
## subclass370 -1.4366492 1.2895546 -1.114 0.26592
## subclass371 1.3083084 1.5123556 0.865 0.38751
## subclass372 -0.6912824 1.4977565 -0.462 0.64466
## subclass373 -0.6400844 1.3118182 -0.488 0.62586
## subclass374 -0.7953464 1.3211447 -0.602 0.54751
## subclass375 1.1064966 1.3302378 0.832 0.40602
## subclass376 -1.1519192 1.3036033 -0.884 0.37742
## subclass377 -0.8499818 1.2973120 -0.655 0.51273
## subclass378 1.3637902 1.2953119 1.053 0.29304
## subclass379 -1.5737653 1.2962654 -1.214 0.22544
## subclass380 -1.1043789 1.4832534 -0.745 0.45697
## subclass381 0.2471553 1.4350325 0.172 0.86334
## subclass382 -0.4132844 1.3017271 -0.317 0.75104
## subclass383 -1.5904853 1.3962241 -1.139 0.25533
## subclass384 -0.9632203 1.2958008 -0.743 0.45771
## subclass385 -0.2052920 1.3143822 -0.156 0.87596
## subclass386 1.4691368 1.3317306 1.103 0.27061
## subclass387 -2.0280088 1.3542507 -1.498 0.13505
## subclass388 -0.7944614 1.3609152 -0.584 0.55970
## subclass389 -0.2469097 1.3390495 -0.184 0.85380
## subclass390 -0.4332177 1.3729675 -0.316 0.75252
## subclass391 0.2707618 1.2936945 0.209 0.83433
## subclass392 0.4722854 1.4239844 0.332 0.74032
## subclass393 -1.5690303 1.3321440 -1.178 0.23957
## subclass394 -0.5811025 1.5641136 -0.372 0.71045
## subclass395 -0.3876188 1.4772303 -0.262 0.79315
## subclass396 -1.1029315 1.3102525 -0.842 0.40042
## subclass397 -0.6865100 1.2960197 -0.530 0.59661
## subclass398 0.4274203 1.3070836 0.327 0.74384
## subclass399 -1.7132594 1.3157972 -1.302 0.19364
## subclass400 -0.0900114 1.3112273 -0.069 0.94531
## subclass401 -1.3371246 1.3314091 -1.004 0.31585
## subclass402 -1.0483049 1.3219127 -0.793 0.42824
## subclass403 -0.6497258 1.4392050 -0.451 0.65191
## subclass404 -0.5103542 1.2862318 -0.397 0.69174
## subclass405 0.2925646 1.5021547 0.195 0.84568
## subclass406 -0.0248021 1.3195940 -0.019 0.98501
## subclass407 0.2643748 1.3339556 0.198 0.84300
## subclass408 1.6591855 1.3185774 1.258 0.20901
## subclass409 0.3722065 1.6099668 0.231 0.81729
## subclass410 -2.1231819 1.3048460 -1.627 0.10449
## subclass411 -0.7594565 1.3770792 -0.551 0.58160
## subclass412 0.5030121 1.3050185 0.385 0.70011
## subclass413 -1.6502052 1.3270080 -1.244 0.21439
## subclass414 0.8668672 1.4291573 0.607 0.54449
## subclass415 -0.1760781 1.4523553 -0.121 0.90356
## subclass416 -1.2980926 1.3256972 -0.979 0.32809
## subclass417 -1.8481297 1.3709479 -1.348 0.17840
## subclass418 -1.2404580 1.3112452 -0.946 0.34471
## subclass419 0.4066469 1.3154976 0.309 0.75739
## subclass420 -0.7731878 1.3957701 -0.554 0.57992
## subclass421 -1.1456476 1.3235246 -0.866 0.38723
## subclass422 -2.3843355 1.4102192 -1.691 0.09166 .
## subclass423 -1.1236092 1.3674488 -0.822 0.41175
## subclass424 -1.0108653 1.3476113 -0.750 0.45363
## subclass425 1.3926360 1.3441575 1.036 0.30080
## subclass426 -0.1832701 1.3600402 -0.135 0.89287
## subclass427 -0.9007424 1.3065533 -0.689 0.49097
## subclass428 -1.0557976 1.3058260 -0.809 0.41927
## subclass429 2.3505200 1.3358420 1.760 0.07925 .
## subclass430 0.4144070 1.4526873 0.285 0.77559
## subclass431 -0.8429464 1.5729748 -0.536 0.59233
## subclass432 0.0568097 1.3809966 0.041 0.96721
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## (Dispersion parameter for gaussian family taken to be 1.583193)
##
## Null deviance: 3543.94 on 863 degrees of freedom
## Residual deviance: 631.69 on 399 degrees of freedom
## AIC: 3113.3
##
## Number of Fisher Scoring iterations: 2
test_match_ds <- test_match_results$match_ps_att_samp_data
test_match_ds
## # A tibble: 864 × 36
## college student_ppnscal parent_OthAct student_SchClub student_Magazine
## <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 1 3 0 4 1
## 2 1 7 0 3 1
## 3 1 2 0 1 1
## 4 0 2 1 1 1
## 5 1 3 1 1 1
## 6 1 2 0 1 3
## 7 1 3 0 1 1
## 8 0 1 0 4 1
## 9 0 3 0 2 1
## 10 0 1 0 3 1
## # ℹ 854 more rows
## # ℹ 31 more variables: parent_FPlans <dbl>, student_Govern <dbl>,
## # student_Hobby <dbl>, student_CCamp <dbl>, parent_SportClub <dbl>,
## # parent_Knowledge <dbl>, student_Govt4All <dbl>, parent_GovtSmart <dbl>,
## # parent_Govt4All <dbl>, parent_StrOpinion <dbl>, parent_FInc <dbl>,
## # student_ClubLev <dbl>, parent_Employ <dbl>, student_community <dbl>,
## # parent_EducHH <dbl>, parent_CLOrg <dbl>, parent_OthHelp <dbl>, …
###### Threshold and Results Function
# Get number of threshold ps and the mean percent improvement in SMD
num_threshold_covs <- function(match_obj) {
# Generate balance stats for both pre and post-matching
balance_stats <- bal.tab(match_obj, abs = TRUE, un = TRUE)
# print(balance_stats)
# Extracting pre and post-matching SMDs
smd_pre <- balance_stats$Balance$Diff.Un
smd_post <- balance_stats$Balance$Diff.Adj
# Count from Balance Table Diff.Adj column for post-matching
num_cov_meeting_threshold <- sum(smd_post <= 0.1, na.rm = TRUE)
# Proportion of covariates meeting the threshold
cov_size <- length(smd_post)
prop <- num_cov_meeting_threshold / cov_size
# Calculate percent improvement per covariate
improvements <- (smd_pre - smd_post) / abs(smd_pre) * 100
# Mean percent improvement across all covariates
mean_improvement <- mean(improvements, na.rm = TRUE)
# Return a list of both metrics
return(list(
num_threshold_covariates = num_cov_meeting_threshold,
proportion_threshold = prop,
mean_percent_improvement = mean_improvement
))
}
# TEST
test_threshold_results <- num_threshold_covs(test_match_ps_att_samp)
library(parallel)
# Set up and run the simulation
set.seed(123)
# Define number of runs
runs <- 10
# Pre-allocate results dataframe
results <- data.frame(
Simulation = integer(runs),
ATT = numeric(runs),
Proportion_Threshold = numeric(runs),
Mean_Percent_Improvement = numeric(runs),
Threshold_Covs = integer(runs),
Balance_Stats = list(runs)
)
# Define vars
treatment_var <- "college"
outcome_var <- "student_ppnscal"
# Define a single iteration function
iteration_function <- function(i) {
rand_cov_df <- select_cov_ps(df_pretreat, treatment_var, outcome_var)
match_obj <- ps_model(rand_cov_df, treatment_var, outcome_var)
matched_results <- create_matchit_ds(match_obj)
ATT <- matched_results$ATT_ps_all
matched_ds <- matched_results$match_ps_att_samp_data
balance_metrics <- num_threshold_covs(match_obj)
c(
Simulation = i,
ATT = ATT,
Proportion_Threshold = balance_metrics$proportion_threshold,
Mean_Percent_Improvement = balance_metrics$mean_percent_improvement,
Threshold_Covs = balance_metrics$num_threshold_covariates
)
}
# Set up a cluster
cl <- makeCluster(detectCores() - 1) # Leave one core free
# Load required packages on all nodes
clusterEvalQ(cl, {
library(MatchIt)
library(cobalt)
})
## [[1]]
## [1] "cobalt" "MatchIt" "stats" "graphics" "grDevices" "utils"
## [7] "datasets" "methods" "base"
##
## [[2]]
## [1] "cobalt" "MatchIt" "stats" "graphics" "grDevices" "utils"
## [7] "datasets" "methods" "base"
##
## [[3]]
## [1] "cobalt" "MatchIt" "stats" "graphics" "grDevices" "utils"
## [7] "datasets" "methods" "base"
##
## [[4]]
## [1] "cobalt" "MatchIt" "stats" "graphics" "grDevices" "utils"
## [7] "datasets" "methods" "base"
##
## [[5]]
## [1] "cobalt" "MatchIt" "stats" "graphics" "grDevices" "utils"
## [7] "datasets" "methods" "base"
##
## [[6]]
## [1] "cobalt" "MatchIt" "stats" "graphics" "grDevices" "utils"
## [7] "datasets" "methods" "base"
##
## [[7]]
## [1] "cobalt" "MatchIt" "stats" "graphics" "grDevices" "utils"
## [7] "datasets" "methods" "base"
# Export necessary objects and functions to the worker nodes
clusterExport(cl, list("select_cov_ps", "ps_model", "create_matchit_ds", "num_threshold_covs", "df_pretreat", "treatment_var", "outcome_var"))
# Execute parallel processing
results <- parSapply(cl, 1:runs, iteration_function)
stopCluster(cl)
# Process results as needed
head(t(results))
## Simulation ATT Proportion_Threshold Mean_Percent_Improvement
## [1,] 1 0.08646439 0.1634615 -57.73887
## [2,] 2 2.34186966 0.2500000 -76.11074
## [3,] 3 -0.54489740 0.1944444 -55.95870
## [4,] 4 1.08174432 0.1025641 -49.83060
## [5,] 5 2.12797718 0.0000000 -64.05090
## [6,] 6 -0.11599636 0.1666667 -49.01004
## Threshold_Covs
## [1,] 17
## [2,] 4
## [3,] 14
## [4,] 4
## [5,] 0
## [6,] 12
results <- t(results)
Plot all of the ATTs against all of the balanced covariate proportions. You may randomly sample or use other techniques like transparency if you run into overplotting problems. Alternatively, you may use plots other than scatterplots, so long as you explore the relationship between ATT and the proportion of covariates that meet the balance threshold.
# plotting as scatterplot relationship
ggplot(as.data.frame(results), aes(x = Proportion_Threshold, y = ATT)) +
geom_point(alpha = 0.1) # very low transparency
labs(x = "Proportion of Covariates Meeting Balance Threshold",
y = "Average Treatment Effect on Treated (ATT)",
title = "Relationship between ATT and Balance Threshold Proportion") +
theme_minimal()
## NULL
# Try hex plots given very dense data
##install.packages("hexbin")
ggplot(as.data.frame(results), aes(x = Proportion_Threshold, y = ATT)) +
geom_hex() +
labs(x = "Proportion of Covariates Meeting Balance Threshold",
y = "Average Treatment Effect on Treated (ATT)",
title = "Hexbin Plot of ATT and Balance Threshold Proportion") +
theme_minimal()
Finally choose 10 random models and plot their covariate balance plots
head(results)
## Simulation ATT Proportion_Threshold Mean_Percent_Improvement
## [1,] 1 0.08646439 0.1634615 -57.73887
## [2,] 2 2.34186966 0.2500000 -76.11074
## [3,] 3 -0.54489740 0.1944444 -55.95870
## [4,] 4 1.08174432 0.1025641 -49.83060
## [5,] 5 2.12797718 0.0000000 -64.05090
## [6,] 6 -0.11599636 0.1666667 -49.01004
## Threshold_Covs
## [1,] 17
## [2,] 4
## [3,] 14
## [4,] 4
## [5,] 0
## [6,] 12
# Running a differnet version to grab data for later plotting covariant balance
# runs <- 10000 ### UNCOMMENT OUT
iteration_function <- function(i) {
rand_cov_df <- select_cov_ps(df_pretreat, treatment_var, outcome_var)
match_obj <- ps_model(rand_cov_df, treatment_var, outcome_var)
matched_results <- create_matchit_ds(match_obj)
# Get balance metrics and compute balance tables directly for storage
balance_metrics <- num_threshold_covs(match_obj)
balance_stats <- bal.tab(match_obj, abs = TRUE, un = TRUE) # Compute balance stats for potential plotting
# Only return necessary summary data, not full matchit objects
list(
Simulation = i,
ATT = matched_results$ATT_ps_all,
Proportion_Threshold = balance_metrics$proportion_threshold,
Mean_Percent_Improvement = balance_metrics$mean_percent_improvement,
Threshold_Covs = balance_metrics$num_threshold_covariates,
Balance_Stats = list(Diff.Un = balance_stats$Balance$Diff.Un,
Diff.Adj = balance_stats$Balance$Diff.Adj) # Store only Diff stats
)
}
# Set up the cluster
cl <- makeCluster(detectCores() - 1)
clusterEvalQ(cl, {
library(MatchIt)
library(cobalt)
})
## [[1]]
## [1] "cobalt" "MatchIt" "stats" "graphics" "grDevices" "utils"
## [7] "datasets" "methods" "base"
##
## [[2]]
## [1] "cobalt" "MatchIt" "stats" "graphics" "grDevices" "utils"
## [7] "datasets" "methods" "base"
##
## [[3]]
## [1] "cobalt" "MatchIt" "stats" "graphics" "grDevices" "utils"
## [7] "datasets" "methods" "base"
##
## [[4]]
## [1] "cobalt" "MatchIt" "stats" "graphics" "grDevices" "utils"
## [7] "datasets" "methods" "base"
##
## [[5]]
## [1] "cobalt" "MatchIt" "stats" "graphics" "grDevices" "utils"
## [7] "datasets" "methods" "base"
##
## [[6]]
## [1] "cobalt" "MatchIt" "stats" "graphics" "grDevices" "utils"
## [7] "datasets" "methods" "base"
##
## [[7]]
## [1] "cobalt" "MatchIt" "stats" "graphics" "grDevices" "utils"
## [7] "datasets" "methods" "base"
clusterExport(cl, list("select_cov_ps", "ps_model", "create_matchit_ds", "num_threshold_covs", "df_pretreat", "treatment_var", "outcome_var"))
# Execute parallel processing
results_final <- parLapply(cl, 1:runs, iteration_function)
stopCluster(cl)
#### Pevously used block
selected_indices <- sample(1:length(results_final), 10) # Select 10 random simulations
# Plot balance statistics for selected simulations
for (idx in selected_indices) {
balance_stats <- results_final[[idx]]$Balance_Stats
plot_data <- data.frame(Diff.Un = balance_stats$Diff.Un, Diff.Adj = balance_stats$Diff.Adj)
p <- ggplot(plot_data, aes(x = Diff.Un, y = Diff.Adj)) +
geom_point() +
labs(title = paste("Balance Plot for Simulation", results_final[[idx]]$Simulation),
x = "Unadjusted Differences", y = "Adjusted Differences") +
theme_minimal()
print(p)
}
# Was having issues with GridExtra, so I've just plotted 10 different make-shift balance plots
# Loop through the first 10 simulations and generate a point plot for each
for (i in 1:10) {
# Extract balance data for this iteration
balance_data <- results_final[[i]]$Balance_Stats
# Compute means
mean_diff_un <- mean(balance_data$Diff.Un)
mean_diff_adj <- mean(balance_data$Diff.Adj)
# Create a dataframe for plotting
balance_summary_df <- data.frame(
Type = c("Unadjusted", "Adjusted"),
Mean_SMD = c(mean_diff_un, mean_diff_adj)
)
# Create the point plot
p <- ggplot(balance_summary_df, aes(x = Type, y = Mean_SMD, color = Type)) +
geom_point(size = 5) +
scale_color_manual(values = c("Unadjusted" = "indianred1", "Adjusted" = "cyan3")) +
theme_minimal() +
theme(legend.position = "none",
plot.title = element_text(hjust = 0.5)) +
labs(title = paste("Simulation", i),
x = "",
y = "Mean Standardized Mean Differences (SMD)")
# Print the plot
print(p)
}
balance_data
## $Diff.Un
## [1] 0.712713269 0.123834401 0.147222307 0.002551408 0.148638762 0.035858544
## [7] 0.205904687 0.175587037 0.030525772 0.194423351
##
## $Diff.Adj
## [1] 1.45390671 0.25942350 0.25720621 0.00886918 0.26847963 0.07998448
## [7] 0.48115299 0.37289337 0.05986696 0.35033259
count_more_balanced_cov <- sum(sapply(results_final, function(x) x$Mean_Percent_Improvement < 0))
count_more_balanced_cov
## [1] 10
Concerningly, there appear to be no instances where the Adjusted SMD improves… there must be an error in the code but I do not see what it is. That being said, we would hope to see a high degree of improvement after matching. If more than maybe half of the simulations saw a decrease in the proportion of balanced covariates I would be concerned. That indicates that matching on a linear regression was not an effective means of aligning data or that many samples were dropped and thus not matched.
2. Analyze the distribution of the ATTs. Do you have any concerns about this distribution?
# Plot a histogram of ATTs
att_values <- sapply(results_final, function(x) x$ATT)
# Create a histogram of the ATT values
ggplot(data.frame(ATT = att_values), aes(x = ATT)) +
geom_histogram(binwidth = 0.1, fill = "cyan3", color = "black") +
theme_minimal() +
labs(title = "Histogram of Average Treatment Effects (ATT)",
x = "ATT",
y = "Frequency")
The obvious concern here is the spike at 0 of the ATT. We could see glimpses of this in the hex diagram above but it is now clear that the most likely outcome is zero.
3. Do your 10 randomly chosen covariate balance plots produce similar numbers on the same covariates? Is it a concern if they do not?
The 10 randomly selected plots do not have very similar SMDs. Typically, if there is a large difference in pre and post-adjustment scores we would expect it to indicate there were confounding variables pre-adjustment and that we have successfully accounted for them. Here, though, the scores increase, which I again am interpreting as an error in my code rather than a truth given it occurs for all simulations.
Henderson/Chatfield propose using genetic matching to learn the best weights for Mahalanobis distance matching. Choose a matching algorithm other than the propensity score (you may use genetic matching if you wish, but it is also fine to use the greedy or optimal algorithms we covered in lab instead). Repeat the same steps as specified in Section 4.2
### Run MatchIt Function -- updated function for genetic
genetic_ps_model <- function(rand_cov_df, treatment_var, outcome_var) {
# List all covariates except 'college' and the outcome variable 'student_ppnscal'
covariate_names <- setdiff(names(rand_cov_df), c("college", "student_ppnscal"))
# Construct the formula manually
formula_str <- paste("college ~", paste(covariate_names, collapse = " + "))
match_formula <- as.formula(formula_str)
# Run MatchIt with the constructed formula
genetic_ps_att <- matchit(formula = match_formula,
data = rand_cov_df,
method = "genetic",
estimand = "ATT"
)
# return
return(genetic_ps_att)
}
# Running a differnet version to grab data for later plotting covariant balance
treatment_var = "college"
outcome_var = "student_ppnscal"
runs <- 10 ### UNCOMMENT OUT
iteration_function <- function(i) {
rand_cov_df <- select_cov_ps(df_pretreat, treatment_var, outcome_var)
match_obj <- genetic_ps_model(rand_cov_df, treatment_var, outcome_var)
matched_results <- create_matchit_ds(match_obj)
# Get balance metrics and compute balance tables directly for storage
balance_metrics <- num_threshold_covs(match_obj)
balance_stats <- bal.tab(match_obj, abs = TRUE, un = TRUE) # Compute balance stats for potential plotting
# Only return necessary summary data, not full matchit objects
list(
Simulation = i,
ATT = matched_results$ATT_ps_all,
Proportion_Threshold = balance_metrics$proportion_threshold,
Mean_Percent_Improvement = balance_metrics$mean_percent_improvement,
Threshold_Covs = balance_metrics$num_threshold_covariates,
Balance_Stats = list(Diff.Un = balance_stats$Balance$Diff.Un,
Diff.Adj = balance_stats$Balance$Diff.Adj) # Store only Diff stats
)
}
# I think these are for genetic matching
#install.packages("Matching")
#install.packages("rgenoud")
### Run clusters
# Set up the cluster
cl <- makeCluster(detectCores() - 1)
clusterEvalQ(cl, {
library(MatchIt)
library(cobalt)
library(Matching)
library(rgenoud)
})
## [[1]]
## [1] "rgenoud" "Matching" "MASS" "cobalt" "MatchIt" "stats"
## [7] "graphics" "grDevices" "utils" "datasets" "methods" "base"
##
## [[2]]
## [1] "rgenoud" "Matching" "MASS" "cobalt" "MatchIt" "stats"
## [7] "graphics" "grDevices" "utils" "datasets" "methods" "base"
##
## [[3]]
## [1] "rgenoud" "Matching" "MASS" "cobalt" "MatchIt" "stats"
## [7] "graphics" "grDevices" "utils" "datasets" "methods" "base"
##
## [[4]]
## [1] "rgenoud" "Matching" "MASS" "cobalt" "MatchIt" "stats"
## [7] "graphics" "grDevices" "utils" "datasets" "methods" "base"
##
## [[5]]
## [1] "rgenoud" "Matching" "MASS" "cobalt" "MatchIt" "stats"
## [7] "graphics" "grDevices" "utils" "datasets" "methods" "base"
##
## [[6]]
## [1] "rgenoud" "Matching" "MASS" "cobalt" "MatchIt" "stats"
## [7] "graphics" "grDevices" "utils" "datasets" "methods" "base"
##
## [[7]]
## [1] "rgenoud" "Matching" "MASS" "cobalt" "MatchIt" "stats"
## [7] "graphics" "grDevices" "utils" "datasets" "methods" "base"
clusterExport(cl, list("select_cov_ps", "genetic_ps_model", "create_matchit_ds", "num_threshold_covs", "df_pretreat", "treatment_var", "outcome_var"))
# Execute parallel processing
genetic_results <- parLapply(cl, 1:runs, iteration_function)
stopCluster(cl)
genetic_df <- do.call(rbind, lapply(genetic_results, function(x) {
data.frame(Simulation = x$Simulation,
ATT = x$ATT,
Proportion_Threshold = x$Proportion_Threshold,
Mean_Percent_Improvement = x$Mean_Percent_Improvement,
Threshold_Covs = x$Threshold_Covs,
Mean_Diff_Un = mean(x$Balance_Stats$Diff.Un),
Mean_Diff_Adj = mean(x$Balance_Stats$Diff.Adj))
}))
print(genetic_df)
## Simulation ATT Proportion_Threshold
## 1 1 0.38467840245992490633 0.06666667
## 2 2 0.57467368659842898992 0.16363636
## 3 3 1.17344815293966187042 0.10526316
## 4 4 0.73467273254082698930 0.11111111
## 5 5 0.96513524357543356569 0.08333333
## 6 6 0.70375509531626145865 0.15384615
## 7 7 -0.01197655772249350131 0.18627451
## 8 8 -0.00000000000001647972 0.15294118
## 9 9 0.84517869614019358604 0.17241379
## 10 10 0.68484149462696053412 0.19230769
## Mean_Percent_Improvement Threshold_Covs Mean_Diff_Un Mean_Diff_Adj
## 1 -53.14750 3 0.2585013 0.3765967
## 2 -53.39166 9 0.2252449 0.3329040
## 3 -76.24215 4 0.2080061 0.3190100
## 4 -57.26443 4 0.2375064 0.3717233
## 5 -116.35927 1 0.1883316 0.4138070
## 6 -78.72165 4 0.2626798 0.4227655
## 7 -50.09910 19 0.2161167 0.3039219
## 8 -53.51746 13 0.2129793 0.3011977
## 9 -60.42133 10 0.2275819 0.3335195
## 10 -69.67184 10 0.2162080 0.3280786
# Plot ATT vs proportion
ggplot(as.data.frame(genetic_df), aes(x = Proportion_Threshold, y = ATT)) +
geom_point(alpha = 0.9)
labs(x = "Proportion of Covariates Meeting Balance Threshold",
y = "Average Treatment Effect on Treated (ATT)",
title = "Relationship between ATT and Balance Threshold Proportion") +
theme_minimal()
## NULL
### Plotting covariate balances again
for (i in 1:10) {
# Extract balance data for this iteration
balance_data <- genetic_results[[i]]$Balance_Stats
# Compute means
mean_diff_un <- mean(balance_data$Diff.Un)
mean_diff_adj <- mean(balance_data$Diff.Adj)
# Create a dataframe for plotting
balance_summary_df <- data.frame(
Type = c("Unadjusted", "Adjusted"),
Mean_SMD = c(mean_diff_un, mean_diff_adj)
)
# Create the point plot
p <- ggplot(balance_summary_df, aes(x = Type, y = Mean_SMD, color = Type)) +
geom_point(size = 5) +
scale_color_manual(values = c("Unadjusted" = "indianred1", "Adjusted" = "cyan3")) +
theme_minimal() +
theme(legend.position = "none",
plot.title = element_text(hjust = 0.5)) +
labs(title = paste("Simulation", i),
x = "",
y = "Mean Standardized Mean Differences (SMD)")
# Print the plot
print(p)
}
higher proportions of balanced covariates?
final_results_df <- do.call(rbind, lapply(results_final, function(x) {
data.frame(Simulation = x$Simulation,
ATT = x$ATT,
Proportion_Threshold = x$Proportion_Threshold,
Mean_Percent_Improvement = x$Mean_Percent_Improvement,
Threshold_Covs = x$Threshold_Covs,
Mean_Diff_Un = mean(x$Balance_Stats$Diff.Un),
Mean_Diff_Adj = mean(x$Balance_Stats$Diff.Adj))
}))
print(head(final_results_df))
## Simulation ATT Proportion_Threshold
## 1 1 1.08324748121865233053 0.1764706
## 2 2 1.24246618596206515051 0.3125000
## 3 3 0.00000000000005076945 0.2288136
## 4 4 0.88218994315521570559 0.2337662
## 5 5 0.00000000000004412232 0.2000000
## 6 6 1.02599831850115608134 0.1311475
## Mean_Percent_Improvement Threshold_Covs Mean_Diff_Un Mean_Diff_Adj
## 1 -70.51328 3 0.1974329 0.3255799
## 2 -87.64789 5 0.2624592 0.4390442
## 3 -49.81734 27 0.2195563 0.2917721
## 4 -52.27250 18 0.2224326 0.3172936
## 5 -47.56927 21 0.2221963 0.3004474
## 6 -58.80712 8 0.2410463 0.3450147
final_prop <- mean(final_results_df$Proportion_Threshold)
genetic_prop <- mean(genetic_df$Proportion_Threshold)
final_prop
## [1] 0.2101216
genetic_prop
## [1] 0.1387794
Based on the small sample, the exact matching method – not the genetic matching – yielded an overall higher proportion of balanced covariates. Had I actually been able to run a full 10,000 simulations the values may have been similar or even flipped but I can only speak to the data I was able to generate.
##install.packages("patchwork")
library("patchwork")
# Facet plot requires a single df which is difficult here given the mismatched data sizes
# Instead I use patchwork to plot two different graphs
p1 <- ggplot(final_results_df, aes(x = Mean_Percent_Improvement)) +
geom_histogram(binwidth = 1, fill = "cyan3", color = "black") +
scale_x_continuous(limits = c(-100, 50))
theme_minimal() +
labs(title = "Histogram of Exact Match Percent Improvement",
x = "Mean Percent Improvement",
y = "Frequency")
## List of 138
## $ line :List of 6
## ..$ colour : chr "black"
## ..$ linewidth : num 0.5
## ..$ linetype : num 1
## ..$ lineend : chr "butt"
## ..$ arrow : logi FALSE
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_line" "element"
## $ rect :List of 5
## ..$ fill : chr "white"
## ..$ colour : chr "black"
## ..$ linewidth : num 0.5
## ..$ linetype : num 1
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_rect" "element"
## $ text :List of 11
## ..$ family : chr ""
## ..$ face : chr "plain"
## ..$ colour : chr "black"
## ..$ size : num 11
## ..$ hjust : num 0.5
## ..$ vjust : num 0.5
## ..$ angle : num 0
## ..$ lineheight : num 0.9
## ..$ margin : 'margin' num [1:4] 0points 0points 0points 0points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : logi FALSE
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ title : chr "Histogram of Exact Match Percent Improvement"
## $ aspect.ratio : NULL
## $ axis.title : NULL
## $ axis.title.x :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : NULL
## ..$ vjust : num 1
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : 'margin' num [1:4] 2.75points 0points 0points 0points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.title.x.top :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : NULL
## ..$ vjust : num 0
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : 'margin' num [1:4] 0points 0points 2.75points 0points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.title.x.bottom : NULL
## $ axis.title.y :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : NULL
## ..$ vjust : num 1
## ..$ angle : num 90
## ..$ lineheight : NULL
## ..$ margin : 'margin' num [1:4] 0points 2.75points 0points 0points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.title.y.left : NULL
## $ axis.title.y.right :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : NULL
## ..$ vjust : num 1
## ..$ angle : num -90
## ..$ lineheight : NULL
## ..$ margin : 'margin' num [1:4] 0points 0points 0points 2.75points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.text :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : chr "grey30"
## ..$ size : 'rel' num 0.8
## ..$ hjust : NULL
## ..$ vjust : NULL
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : NULL
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.text.x :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : NULL
## ..$ vjust : num 1
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : 'margin' num [1:4] 2.2points 0points 0points 0points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.text.x.top :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : NULL
## ..$ vjust : num 0
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : 'margin' num [1:4] 0points 0points 2.2points 0points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.text.x.bottom : NULL
## $ axis.text.y :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : num 1
## ..$ vjust : NULL
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : 'margin' num [1:4] 0points 2.2points 0points 0points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.text.y.left : NULL
## $ axis.text.y.right :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : num 0
## ..$ vjust : NULL
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : 'margin' num [1:4] 0points 0points 0points 2.2points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.text.theta : NULL
## $ axis.text.r :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : num 0.5
## ..$ vjust : NULL
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : 'margin' num [1:4] 0points 2.2points 0points 2.2points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.ticks : list()
## ..- attr(*, "class")= chr [1:2] "element_blank" "element"
## $ axis.ticks.x : NULL
## $ axis.ticks.x.top : NULL
## $ axis.ticks.x.bottom : NULL
## $ axis.ticks.y : NULL
## $ axis.ticks.y.left : NULL
## $ axis.ticks.y.right : NULL
## $ axis.ticks.theta : NULL
## $ axis.ticks.r : NULL
## $ axis.minor.ticks.x.top : NULL
## $ axis.minor.ticks.x.bottom : NULL
## $ axis.minor.ticks.y.left : NULL
## $ axis.minor.ticks.y.right : NULL
## $ axis.minor.ticks.theta : NULL
## $ axis.minor.ticks.r : NULL
## $ axis.ticks.length : 'simpleUnit' num 2.75points
## ..- attr(*, "unit")= int 8
## $ axis.ticks.length.x : NULL
## $ axis.ticks.length.x.top : NULL
## $ axis.ticks.length.x.bottom : NULL
## $ axis.ticks.length.y : NULL
## $ axis.ticks.length.y.left : NULL
## $ axis.ticks.length.y.right : NULL
## $ axis.ticks.length.theta : NULL
## $ axis.ticks.length.r : NULL
## $ axis.minor.ticks.length : 'rel' num 0.75
## $ axis.minor.ticks.length.x : NULL
## $ axis.minor.ticks.length.x.top : NULL
## $ axis.minor.ticks.length.x.bottom: NULL
## $ axis.minor.ticks.length.y : NULL
## $ axis.minor.ticks.length.y.left : NULL
## $ axis.minor.ticks.length.y.right : NULL
## $ axis.minor.ticks.length.theta : NULL
## $ axis.minor.ticks.length.r : NULL
## $ axis.line : list()
## ..- attr(*, "class")= chr [1:2] "element_blank" "element"
## $ axis.line.x : NULL
## $ axis.line.x.top : NULL
## $ axis.line.x.bottom : NULL
## $ axis.line.y : NULL
## $ axis.line.y.left : NULL
## $ axis.line.y.right : NULL
## $ axis.line.theta : NULL
## $ axis.line.r : NULL
## $ legend.background : list()
## ..- attr(*, "class")= chr [1:2] "element_blank" "element"
## $ legend.margin : 'margin' num [1:4] 5.5points 5.5points 5.5points 5.5points
## ..- attr(*, "unit")= int 8
## $ legend.spacing : 'simpleUnit' num 11points
## ..- attr(*, "unit")= int 8
## $ legend.spacing.x : NULL
## $ legend.spacing.y : NULL
## $ legend.key : list()
## ..- attr(*, "class")= chr [1:2] "element_blank" "element"
## $ legend.key.size : 'simpleUnit' num 1.2lines
## ..- attr(*, "unit")= int 3
## $ legend.key.height : NULL
## $ legend.key.width : NULL
## $ legend.key.spacing : 'simpleUnit' num 5.5points
## ..- attr(*, "unit")= int 8
## $ legend.key.spacing.x : NULL
## $ legend.key.spacing.y : NULL
## $ legend.frame : NULL
## $ legend.ticks : NULL
## $ legend.ticks.length : 'rel' num 0.2
## $ legend.axis.line : NULL
## $ legend.text :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : 'rel' num 0.8
## ..$ hjust : NULL
## ..$ vjust : NULL
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : NULL
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ legend.text.position : NULL
## $ legend.title :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : num 0
## ..$ vjust : NULL
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : NULL
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ legend.title.position : NULL
## $ legend.position : chr "right"
## $ legend.position.inside : NULL
## $ legend.direction : NULL
## $ legend.byrow : NULL
## $ legend.justification : chr "center"
## $ legend.justification.top : NULL
## $ legend.justification.bottom : NULL
## $ legend.justification.left : NULL
## $ legend.justification.right : NULL
## $ legend.justification.inside : NULL
## $ legend.location : NULL
## $ legend.box : NULL
## $ legend.box.just : NULL
## $ legend.box.margin : 'margin' num [1:4] 0cm 0cm 0cm 0cm
## ..- attr(*, "unit")= int 1
## $ legend.box.background : list()
## ..- attr(*, "class")= chr [1:2] "element_blank" "element"
## $ legend.box.spacing : 'simpleUnit' num 11points
## ..- attr(*, "unit")= int 8
## [list output truncated]
## - attr(*, "class")= chr [1:2] "theme" "gg"
## - attr(*, "complete")= logi TRUE
## - attr(*, "validate")= logi TRUE
p2 <- ggplot(genetic_df, aes(x = Mean_Percent_Improvement)) +
geom_histogram(binwidth = 1, fill = "cyan3", color = "black") +
scale_x_continuous(limits = c(-100, 50))
theme_minimal() +
labs(title = "Histogram of Genetic Match Percent Improvement",
x = "Mean Percent Improvement",
y = "Frequency")
## List of 138
## $ line :List of 6
## ..$ colour : chr "black"
## ..$ linewidth : num 0.5
## ..$ linetype : num 1
## ..$ lineend : chr "butt"
## ..$ arrow : logi FALSE
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_line" "element"
## $ rect :List of 5
## ..$ fill : chr "white"
## ..$ colour : chr "black"
## ..$ linewidth : num 0.5
## ..$ linetype : num 1
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_rect" "element"
## $ text :List of 11
## ..$ family : chr ""
## ..$ face : chr "plain"
## ..$ colour : chr "black"
## ..$ size : num 11
## ..$ hjust : num 0.5
## ..$ vjust : num 0.5
## ..$ angle : num 0
## ..$ lineheight : num 0.9
## ..$ margin : 'margin' num [1:4] 0points 0points 0points 0points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : logi FALSE
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ title : chr "Histogram of Genetic Match Percent Improvement"
## $ aspect.ratio : NULL
## $ axis.title : NULL
## $ axis.title.x :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : NULL
## ..$ vjust : num 1
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : 'margin' num [1:4] 2.75points 0points 0points 0points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.title.x.top :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : NULL
## ..$ vjust : num 0
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : 'margin' num [1:4] 0points 0points 2.75points 0points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.title.x.bottom : NULL
## $ axis.title.y :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : NULL
## ..$ vjust : num 1
## ..$ angle : num 90
## ..$ lineheight : NULL
## ..$ margin : 'margin' num [1:4] 0points 2.75points 0points 0points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.title.y.left : NULL
## $ axis.title.y.right :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : NULL
## ..$ vjust : num 1
## ..$ angle : num -90
## ..$ lineheight : NULL
## ..$ margin : 'margin' num [1:4] 0points 0points 0points 2.75points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.text :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : chr "grey30"
## ..$ size : 'rel' num 0.8
## ..$ hjust : NULL
## ..$ vjust : NULL
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : NULL
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.text.x :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : NULL
## ..$ vjust : num 1
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : 'margin' num [1:4] 2.2points 0points 0points 0points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.text.x.top :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : NULL
## ..$ vjust : num 0
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : 'margin' num [1:4] 0points 0points 2.2points 0points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.text.x.bottom : NULL
## $ axis.text.y :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : num 1
## ..$ vjust : NULL
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : 'margin' num [1:4] 0points 2.2points 0points 0points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.text.y.left : NULL
## $ axis.text.y.right :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : num 0
## ..$ vjust : NULL
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : 'margin' num [1:4] 0points 0points 0points 2.2points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.text.theta : NULL
## $ axis.text.r :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : num 0.5
## ..$ vjust : NULL
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : 'margin' num [1:4] 0points 2.2points 0points 2.2points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.ticks : list()
## ..- attr(*, "class")= chr [1:2] "element_blank" "element"
## $ axis.ticks.x : NULL
## $ axis.ticks.x.top : NULL
## $ axis.ticks.x.bottom : NULL
## $ axis.ticks.y : NULL
## $ axis.ticks.y.left : NULL
## $ axis.ticks.y.right : NULL
## $ axis.ticks.theta : NULL
## $ axis.ticks.r : NULL
## $ axis.minor.ticks.x.top : NULL
## $ axis.minor.ticks.x.bottom : NULL
## $ axis.minor.ticks.y.left : NULL
## $ axis.minor.ticks.y.right : NULL
## $ axis.minor.ticks.theta : NULL
## $ axis.minor.ticks.r : NULL
## $ axis.ticks.length : 'simpleUnit' num 2.75points
## ..- attr(*, "unit")= int 8
## $ axis.ticks.length.x : NULL
## $ axis.ticks.length.x.top : NULL
## $ axis.ticks.length.x.bottom : NULL
## $ axis.ticks.length.y : NULL
## $ axis.ticks.length.y.left : NULL
## $ axis.ticks.length.y.right : NULL
## $ axis.ticks.length.theta : NULL
## $ axis.ticks.length.r : NULL
## $ axis.minor.ticks.length : 'rel' num 0.75
## $ axis.minor.ticks.length.x : NULL
## $ axis.minor.ticks.length.x.top : NULL
## $ axis.minor.ticks.length.x.bottom: NULL
## $ axis.minor.ticks.length.y : NULL
## $ axis.minor.ticks.length.y.left : NULL
## $ axis.minor.ticks.length.y.right : NULL
## $ axis.minor.ticks.length.theta : NULL
## $ axis.minor.ticks.length.r : NULL
## $ axis.line : list()
## ..- attr(*, "class")= chr [1:2] "element_blank" "element"
## $ axis.line.x : NULL
## $ axis.line.x.top : NULL
## $ axis.line.x.bottom : NULL
## $ axis.line.y : NULL
## $ axis.line.y.left : NULL
## $ axis.line.y.right : NULL
## $ axis.line.theta : NULL
## $ axis.line.r : NULL
## $ legend.background : list()
## ..- attr(*, "class")= chr [1:2] "element_blank" "element"
## $ legend.margin : 'margin' num [1:4] 5.5points 5.5points 5.5points 5.5points
## ..- attr(*, "unit")= int 8
## $ legend.spacing : 'simpleUnit' num 11points
## ..- attr(*, "unit")= int 8
## $ legend.spacing.x : NULL
## $ legend.spacing.y : NULL
## $ legend.key : list()
## ..- attr(*, "class")= chr [1:2] "element_blank" "element"
## $ legend.key.size : 'simpleUnit' num 1.2lines
## ..- attr(*, "unit")= int 3
## $ legend.key.height : NULL
## $ legend.key.width : NULL
## $ legend.key.spacing : 'simpleUnit' num 5.5points
## ..- attr(*, "unit")= int 8
## $ legend.key.spacing.x : NULL
## $ legend.key.spacing.y : NULL
## $ legend.frame : NULL
## $ legend.ticks : NULL
## $ legend.ticks.length : 'rel' num 0.2
## $ legend.axis.line : NULL
## $ legend.text :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : 'rel' num 0.8
## ..$ hjust : NULL
## ..$ vjust : NULL
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : NULL
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ legend.text.position : NULL
## $ legend.title :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : num 0
## ..$ vjust : NULL
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : NULL
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ legend.title.position : NULL
## $ legend.position : chr "right"
## $ legend.position.inside : NULL
## $ legend.direction : NULL
## $ legend.byrow : NULL
## $ legend.justification : chr "center"
## $ legend.justification.top : NULL
## $ legend.justification.bottom : NULL
## $ legend.justification.left : NULL
## $ legend.justification.right : NULL
## $ legend.justification.inside : NULL
## $ legend.location : NULL
## $ legend.box : NULL
## $ legend.box.just : NULL
## $ legend.box.margin : 'margin' num [1:4] 0cm 0cm 0cm 0cm
## ..- attr(*, "unit")= int 1
## $ legend.box.background : list()
## ..- attr(*, "class")= chr [1:2] "element_blank" "element"
## $ legend.box.spacing : 'simpleUnit' num 11points
## ..- attr(*, "unit")= int 8
## [list output truncated]
## - attr(*, "class")= chr [1:2] "theme" "gg"
## - attr(*, "complete")= logi TRUE
## - attr(*, "validate")= logi TRUE
combined_plot <- p1 / p2
# Customize layout and add a plot title
final_plot <- combined_plot +
plot_layout(guides = 'collect') + # Collect legends if necessary
plot_annotation(title = "Comparison of Mean Percent Improvements")
# Print the final combined plot
print(final_plot)
Despite the small sample size it is already evident that the genetic matching algorithm is performing similarly. The improvement is again negative which I believe to be attributable to how I manually calculated the SMDs, though I don’t understand why. It is interesting that both seem to center on 50% “improvement” – I am not sure whether this is an expected outcome for any data or if it is particular to our sample.
1. Why might it be a good idea to do matching even if we have a randomized or as-if-random design?
Even in a randomized design setup, conducting matching can help enhance the robustness of the results as we saw in the first part of this project with improving covariate balance. We might expect randomization to balance covariates across treatment and control groups, but in practice, especially with small sample sizes, random allocation might not achieve adequate balance. Matching post-randomization can further balance covariates, reducing variance and improving the precision of the estimated treatment effects. If randomization inadvertently results in imbalances in key covariates, matching can correct these ensuring that the comparison between treatment and control groups is as fair as possible.
2. The standard way of estimating the propensity score is using a logistic regression to estimate probability of treatment. Given what we know about the curse of dimensionality, do you think there might be advantages to using other machine learning algorithms (decision trees, bagging/boosting forests, ensembles, etc.) to estimate propensity scores instead?
Decision Tree and Random Forest models may be well-suited for capturing interactions between variables that a logistic regression might miss and are capable of modeling non-linear relationships that could become misrepresented in logistic regressions. They also don’t need the researcher to explicitly specify interaction terms as we did here. Boosting then would also be valuable given its expansion on decision trees and error correcting process. I believe it would also offer a strong predictor given it combines multiple weak predictors.